Sha256: cfe3215dd625e61d3426f31e0c38d9cbc034f6e72b1ef35e5365825c1c8d8479
Contents?: true
Size: 1.29 KB
Versions: 9
Compression:
Stored size: 1.29 KB
Contents
module DataMapper # :nodoc: module MigrationRunner # :nodoc: def self.reset! @@migrations = [] end end end module SQL # :nodoc: module Sqlite3 # :nodoc: def property_schema_statement(schema) statement = super statement << ' PRIMARY KEY AUTOINCREMENT' if supports_serial? && schema[:serial] statement end end # Sqlite3 class TableModifier # :nodoc: def add_column(name, type, opts = {}) column = SQL::TableCreator::Column.new(@adapter, name, build_type(name, type), opts) @statements << "ALTER TABLE #{quoted_table_name} ADD COLUMN #{column.to_sql}" end def change_column(name, type, opts = {}) # raise NotImplemented for SQLite3 @statements << "ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quote_column_name(name)} TYPE #{build_type(name, type, opts).gsub(quote_column_name(name), '').gsub('NOT NULL', '')}" end def build_type(name, type_class, options = @opts) schema = {:name => name.to_s, :quote_column_name => quote_column_name(name)}.merge(options) schema[:serial?] ||= schema[:serial] schema[:nullable?] ||= schema[:nullable] schema = @adapter.class.type_map[type_class].merge(schema) @adapter.property_schema_statement(schema) end end # TableModifier end # SQL
Version data entries
9 entries across 9 versions & 1 rubygems