Can ActiveRecord in Rails generate database schema
Hi Does anyone know if a model in Rails can be used to generate a database schema?
Thanks, Mark开发者_如何学Python
I believe you are looking for migrations in Rails: http://guides.rubyonrails.org/migrations.html
If you use the rails generators to create your models then your migrations are also generated for you and all you have to run is
rake db:migrate
in order to get your schema in the database
You can also refer to schema.rb to look at your current state of the schema
精彩评论