【发布时间】:2011-04-05 18:48:39
【问题描述】:
我喜欢 Rails,但我不是迁移的忠实粉丝。
如何在不使用 SQL 和迁移的情况下使用 ActiveRecord::Scema 工具创建数据库?
我知道你是这样使用它的:
ActiveRecord::Schema.define do
create_table :authors do |t|
t.string :name, :null => false
end
add_index :authors, :name, :unique
create_table :posts do |t|
t.integer :author_id, :null => false
t.string :subject
t.text :body
t.boolean :private, :default => false
end
add_index :posts, :author_id
end
但是你如何运行它呢?
请不要推荐使用迁移,因为我……根本不喜欢它们。
【问题讨论】:
标签: ruby-on-rails database-schema