Welcome Guest, Not a member yet? Register   Sign In
Introducing Migrations to CodeIgniter
#1

[eluser]barbazul[/eluser]
Migrations is an utility that lets you abtract database schema changes and apply / unapply them easily in a way that makes team working less tedious.

This is a simple version that mimics most of the Ruby on Rails migration utility funcionality.

It comes with an unfinished dbutil which I began to develop to make clearer migration code.

Wiki

Download
#2

[eluser]sophistry[/eluser]
this looks really helpful. i've never used a db migration utility before but i've recently moved to a new version of a project and basically rewrote the entire schema by hand. but, after i'd done it i realized i had to get the existing data into the new schema. i normalized the schema and there was no easy way to rebuild it, so i did it piecemeal (coding custom importing loops by hand).

what do you do about the data when you remove or significantly alter a table? (e.g., normalize it)

is there a facility for backing up the data in the tables before migrations? restoring after? specifying alterations that result in normalization so the data can be cleanly moved just like the schema?

thanks!
#3

[eluser]barbazul[/eluser]
The migration utility is mostly oriented to help you migrate your database structure.

However you are free to create complex migrations in a data-oriented fashion.

Anyway if you are working on a MySQL database, the easiest way is to use dbutil->backup functionality
#4

[eluser]danfreak[/eluser]
Great one!

;-)

Dan
#5

[eluser]moresided[/eluser]
Hi

Thanks for this - but I can't get it to work, even straight out of the box. I'm getting:

Fatal error: Call to undefined function create_table() in 001_create_articles_schema.php on line 9

I know this relates to using the dbutil helper but I can't see how to get this to work - the wiki isn't very clear:

"Both functions: create_table and drop_table are defined in the dbutil helper. If you do not want to use this helper, you can always call get_instance() to retrieve the CI instance and call each query in the traditional way."

Any help greatly appreciated.

Thanks
#6

[eluser]barbazul[/eluser]
It's my bad I mixed an example using the dbutil helper (which i never released) with the las release.
Anyway I have abandoned the db util helper since there is a dbforge library that can take care of all the hard work with database maintenance.
So i'd suggest you adapt the examples to make it work using that implementation instead

let me know if you need any help doing this




Theme © iAndrew 2016 - Forum software by © MyBB