24 lines
472 B
Ruby
24 lines
472 B
Ruby
ActiveRecord::Base.establish_connection(
|
|
adapter: "sqlite3",
|
|
database: ":memory:",
|
|
)
|
|
|
|
migration_class =
|
|
if ActiveRecord::Migration.respond_to?(:[])
|
|
ActiveRecord::Migration[4.2]
|
|
else
|
|
ActiveRecord::Migration
|
|
end
|
|
|
|
class CreateSchema < migration_class
|
|
def self.up
|
|
create_table :categories, force: true do |t|
|
|
t.string :name
|
|
end
|
|
end
|
|
end
|
|
|
|
CreateSchema.suppress_messages { CreateSchema.migrate(:up) }
|
|
|
|
class Category < ActiveRecord::Base; end
|