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

Allow for automatic database Migrations on application start #766

Closed
4 tasks done
neokoenig opened this issue Apr 19, 2017 · 4 comments
Closed
4 tasks done

Allow for automatic database Migrations on application start #766

neokoenig opened this issue Apr 19, 2017 · 4 comments
Assignees
Labels
Milestone

Comments

@neokoenig
Copy link
Contributor

neokoenig commented Apr 19, 2017

This would comprise of several parts:

  • Add ability to turn off environment switching via URL
  • Note: Dev should still be able to reload app via ?reload=true&password=foo
  • Add environment setting of allowEnvironmentSwitchViaUrl, defaulting to true
  • Add an additional convenience method of migrateToLatest() for dbmigrate
  • Add environment setting of autoMigrateDatabase, defaulting to false

Why would you want this? Use cases would be:

  • You want to lock down environment switching, i.e, only ever allow production mode for security lockdown purposes: with "more" in the core now, i.e, Routing GUI, Migration GUI and internal embedded documentation, I can imagine this being popular.
  • You want to be able to migrate your database without having to switch to maintenance mode, then switching back again
  • You want to update your db via migrate but you use elastic beanstalk/cluster/loadbalancer, and if you have a session-less app (like an api) you might not get routed to the same instance each time (thus some instances would be in maintenance mode and you can't easily get "back" to them)
  • You have a codebase where people update their code, and just want it to "work" - a la wordpress updaters etc.

Caveats:

  • This would fire for each node on a cluster and would fire on each application restart; however, I think the overhead is minimal.
  • Errors would be difficult to rectify; however, there is an assumption that the developer has run the migrations locally first at least..

Would welcome any further suggestions before I implement.

@neokoenig neokoenig added this to the 2.0.0 milestone Apr 19, 2017
@neokoenig neokoenig self-assigned this Apr 19, 2017
@chapmandu
Copy link
Contributor

chapmandu commented Apr 19, 2017

I don't have any suggestions but would be the first to disable environment switching and enabling migration on application start!

@perdjurner
Copy link
Contributor

Nice!

Only docs left?

Moving out of the Beta milestone then.

@perdjurner perdjurner modified the milestones: 2.0.0, 2.0.0 Beta Apr 19, 2017
@neokoenig
Copy link
Contributor Author

Yarp :)

@neokoenig
Copy link
Contributor Author

This feature now documented at https://docs.cfwheels.org/v2.0/docs/migrations-in-production - still need to do the rest of the dbmigrate docs though

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

No branches or pull requests

4 participants