简体   繁体   中英

Rails Test DB and Development DB out of synch

I am developping an application with Rails. I am using the structure.sql schema format, posgresql as db, minitest for testing.

After I modified a table column (rename, changed default, added limit) and ran the migration and started getting some strange behaviour.

Specifics : I renamed the column 'hon' of the table 'supplier_provider_contacts' to 'honorific'. After I ran the migration, I ran a test and got an error coming from the fixtures saying that table 'supplier_provider_contacts' has no column called 'honorific'. However when I look at my structure.sql file, there is a column by that name.

This leads me to believe that my test and development schemas are no longer in synch. Is there an easy way to get my test schema in the same version as my dev schema?

There is a rails task to recreate your test database using the current db/schema.rb or structure.sql :

% bin/rails db:test:prepare

That should resynchronize your test and development databases.

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