[UPHPU] Database Migration tools in PHP
MilesTogoe
miles.togoe at gmail.com
Mon Nov 24 19:18:16 MST 2008
David Boucha wrote:
>> Allowing any developer access to modify the database without express
>> permission or doing an impact analysis is asking for trouble.
>>
>>
>>
> Great point.
>
>
>
>> In reading about CodeIgniter's database migration tool - it allows the
>> developer
>> to do the following (granted i only reviewed a small portion and have not
>> used
>> the tool so this might not be everything):
>>
>> '* Each individual in a team is supposedly working on their own
>> installation of
>> your system.
>> * Whenever a team member makes a change to their database schema, he
>> extracts
>> that change into a class called a "migration".
>> * When he is done working, he can move those "changes" to any other
>> environment
>> (the "live" environment, for example) and "install" each migration'
>> - CodeIgnitor
>>
>> One thing that is unsettling to me is the fact that any developer can make
>> changes and add that to the code base. Here in lies the issue - (IMHO) not
>> every
>> developer should be making the changes to the database that could be added
>> to a
>> production db. I don't want jr developers making changes to my db. I
>> think
>> your statements are true that there needs to be tons of communication and i
>> think there needs to be something to prohibit developers from making
>> changes
>> without some method to manage those changes. For this reason I am a big
>> fan of
>> code and database reviews and analysis before that code is introduced into
>> a
>> production baseline.
>>
>>
>> --
>> thebigdog
>>
>>
>
> thebigdog, yes, I was referring to "migrating" changes from a development
> database to production. As in keeping track of additions and changes to the
> database during development of a project.
>
> The reason I was interested in such a system comes from a project I was
> involved with part-time this last summer. There were 4 full time developers
> working on this project, and I only worked on it 2 or 3 days of the week. I
> only had access to my local copy of the code and database. I found it very
> difficult to keep my database in sync with the main development database.
> The did keep a file with all the database scripts in it, but it was hard to
> know which ones I had already applied to my copy of the database and they
> didn't have any of the data that the application needed; such as menu items
> and other things.
>
> I think that for smaller groups a tool to help manage the database could be
> very helpful. I just haven't tried it yet, so I was wondering if anyone else
> had any experience with something similar.
>
Having migrations is nice, whether for just one or for more team members
- for example the Rails migrations are really spoiling - once you get
used to using it, it's hard to go back to a more manual way. I have
seen 2 big benefits - 1) it provides a nice logging audit trail - yes,
you can also do this by using VCS with good commit messages but the
migrations are handy. The 2nd big benefit is the ease and less error
prone way of making changes to the data - for example SQLite doesn't
offer much in the way of alter table yet at least in the Rails migration
tool it handles the dirty work of deleting columns, etc. If you do mess
up, at least with migrations you see what you did and can hopefully
correct it. To me now, migrations is one of the key items in evaluating
development approaches. I haven't tried out the CodeIgniter migration
tool but if it is similar, I would recommend trying it out.
More information about the UPHPU
mailing list