0

I have faced an interesting case. What happened is that i recently switched to data_migrate gem for running migrations in my rails project. In my local system, everything works swiftly. On running migration the schema is updated successfully and the model has also reflected changes as per the migration.

Also in my dev server, everything goes smoothly; migrations are run correctly and the schema is also updated as per the migration. However, in the model, the fields which were supposed to be introduced via migration don't show up in the model. Also checked the status of the migration, i can see the migration being listed.

Possible duplicate of this question but the answer accepted by the OP doesn't help in my case. Any help is highly appreciated!!

googlesnet
  • 85
  • 9
  • What do you mean by not showing up in model? The model is just a Ruby class, are you referring to the database table? – Eyeslandic Feb 17 '22 at 19:39
  • @Eyeslandic Yes, db table. What i meant was i went to the rails console and ran `Model.attribute_names` and also `Model.new` and found out that the field that should have been produced by migration is not there. I also tried creating a record but did not get the result i wanted. – googlesnet Feb 18 '22 at 05:38
  • for future readers; my findings were, 1. the migrations are only applied to the `public` schema, if you are using PG, with `data_migrate` gem, 2. when the schema is switched the changes do not get applied for other schemas in the db. – googlesnet Mar 09 '22 at 19:38

0 Answers0