Database Migrations Method |
[eluser]adamfairholm[/eluser]
Hey all, I'm familiar with the method of database migrations where per version you have an up/down function where you modify the database based on the version number. The problem is I get really confused and end up screwing something up. I'm trying to find an easier way to automatically handle database migrations but a lot of searching has turned up nothing. I was wondering some things about the following method/code. The basic idea is that you have a database schema array which holds the tables makeup info, but also some other info like anything that was renamed and anything that is deprecated. You just update the array, and then to upgrade the database, you just run it through a migrations function. So my questions are - does this method already exist in another library that is more battle tested than mine? I may have missed something in my search. If not, does anyone see any potential dealbreakers for a method like this? I've tested it out over the course of a few days and it does the job well, and I'm excited about only having one line to upgrade things, but I'm interested to see what other people think of the usefulness of a method like this. Adam Here is the library: https://gist.github.com/918563 Here is an example schema array: Code: $schema = array(
[eluser]snifty[/eluser]
Bump... Can any of the gurus around here make a suggestion for handling migrations in the modern (2.0) era? I have found lots of libs around, just wondering which one people have had positive experiences using. |
Welcome Guest, Not a member yet? Register Sign In |