Is there a that db:migrate ignores some of the scaffoldings generated by rails?

I have put a bunch of tables within one migrate file and have generated scaffolding related to those tables, but every time i run the rake db:migrate command it generates more migration tables and files is there a way to ignore the scaffolding and is it good to do so?

Posted about 3 years ago by JrK
Posted about 3 years ago by Alex Yang

I don't fully understand your question. When you run the 'rails generate scaffold ...' command, your app will automatically create migrations for you to add the right database tables you need (it won't execute these migrations though - that's what 'rake db:migrate' is for). You'll be able to see these migrations added in the db/migrate folder of your app.

However, these migrations won't be executed until you run the 'rake db:migrate' command. Running 'rake db:migrate:status' will show you which of your migrations have been executed (in general, these should all be listed as 'up'). The 'rake db:migrate' command will execute all of your 'down' migrations (it won't ignore migrations that were created via scaffolding). If successful, these migrations should show up as 'up' afterward.

Hope that helps!

1
Posted about 3 years ago by JrK

Yeah I see how it was a confusing question but i was just confusing myself thanks i figured it out

1