Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrations based on environment #2

Open
antonsamper opened this issue Feb 7, 2016 · 2 comments
Open

Migrations based on environment #2

antonsamper opened this issue Feb 7, 2016 · 2 comments

Comments

@antonsamper
Copy link

It would be really nice to be able to run migrations that apply to the current environment. The implementation could be similar to how Loopback currently deals with environment based configs. For example, if you only want to run a migration on stage you could name you file 0001-migration.stage.js or if you only wanted to run it on production, it would be 0001-migration.production.js.

@sundeepgupta
Copy link
Contributor

@antonsamper I'm curious, why would you ever want to do this? I worked with Rails for a while and all migrations ran on all environments.

@antonsamper
Copy link
Author

@sundeepgupta In general, I agree that migrations should run on all environments but it does depend on what the migration is doing. In my case I was using them to add data to the database. At the time, i was trying to setup up a fully functional dev environment (including dummy data) so that coworkers could get the app running without having to manually add anything. However, as this was dummy data, i didn't want it in production.

I know i could add environment checks in the migrations but i thought it could be quite nice to take the existing concept of appending the environment name to the filename.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants