class ObjectFramework::SQLite::Schema::Editor
Attributes
Public Class Methods
Source
# File lib/object_framework/sqlite/schema.rb, line 92 def initialize(schema); @schema, @actions = schema, []; end
Public Instance Methods
Source
# File lib/object_framework/sqlite/schema.rb, line 94 def add_column(table, column, type: :string) table, column = @schema.identifier(table), @schema.identifier(column) fields = @schema.table(table) raise ConfigurationError, "Column already exists" if fields.key?(column) fields[column] = @schema.validate_type(type) @actions << "ALTER TABLE #{@schema.quote(table)} ADD COLUMN #{@schema.quote(column)} #{TYPES.fetch(type)}" end