class ActiveRecord::Schema
support migrations, the two features being very similar.
ActiveRecord::Schema is only supported by database adapters that also
end
add_index :posts, :author_id
end
t.boolean :private, default: false
t.text :body
t.string :subject
t.integer :author_id, null: false
create_table :posts do |t|
add_index :authors, :name, :unique
end
t.string :name, null: false
create_table :authors do |t|<br>ActiveRecord::Schema.define do
Usage:
databases.
directly, so your applications can more easily support multiple
DSL. This means you can define tables, indexes, etc. without using SQL
Allows programmers to programmatically define a schema in a portable
= Active Record Schema
def self.[](version)
def self.[](version) @class_for_version ||= {} @class_for_version[version] ||= Class.new(Migration::Compatibility.find(version)) do include Definition end end