简体   繁体   中英

How do migrations affect the schema.rb file?

I am a little confused how migrations affect schema.rb file?

For example if I write a migration to rename a table column and run that migratin and even do a schema:load rake task too, then when I open my schema.rb file should it automatically be changed to have that new column name? or should I manually change it in there too?

Also my create_table*.rb files that create the original tables. They automatically have a t.timestamp field defined in them that creates those two created_at and updated_at fields in the schema, so if I want to remove those is it enough to just alter the create_table*.rb file and take out t.timestamp from them? and run the migration? or again I should manually alter shcema.rb file too?

So if someone can explain a little bit how there work together would be great.

The schema file is automatically altered when you run migrations. You should never have to manually edit it.

See this Rails Guide for moer information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM