Reputation: 1865
Is there a way to organize migration files in the db/migrate
folder?
Because you quickly have tons of migration files in this folder and it would be great to have something like:
db/migrate/user_migrations/
timestamp_create_users.rb
timestamp_create_addresses.rb
And so on...
Is there a simple way to do this? Some kind of configuration? Is it a bad practice and should I absolutely not do this?
If anyone has any piece of information about that, I'll be glad to hear!
Upvotes: 1
Views: 1064
Reputation: 176352
There is currently no way to do this and also no reason. There will be cased where a single migration touches several models and features, a model-based categorization is not very appropriate.
You can also delete very old migrations if you already applied them to all your systems or if they invalidate each other (such as the migration to create table A that is then subsequently removed).
Someone may argue that removing a migration may cause the system to not be bootstrapped from scratch. However, migrations should not be used for this. In fact, migrations are only used to alter the database. To load the schema for an empty database you should use $ rake db:schema:load
.
Upvotes: 5