CodeIgniter Forums
Database updates for live application - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Database updates for live application (/showthread.php?tid=63536)



Database updates for live application - Sentro - 11-11-2015

Hello,

I've been using Codeigniter for the past year and and currently have my application in beta testing. I've had a couple of issue here and there updating the database.

First method i tried was upon update ( ajax call from client to my server ) include a file in the update with some queries which was included after all the files were downloaded. I've had some issues there due to php limits, depending also on the update size.

Second method ( the one i currently use ) is using hooks. Checking if a certain file exists ( which i include in the update files ) that contains queries. If so include it and run those queries and do the DB changes. I've had better success with this overall ( less complains ) but still if a query happens to fail 1st i'm not able to see which one and second of all if an error happens and stops then on refresh i'll run the queries again until the error and so on. So there is no way out.

Now i've looked into Codeigniter Migrations and will probably head that way.

I just want to know if what everybody else is using and maybe some tips on the Migrations or if i should follow something else.

Thank you in advance


RE: Database updates for live application - sintakonte - 11-11-2015

if you want to this with the CI-way you need to this with migrations everything else would be reinventing the wheel
and migrations with the up/down principle are really fine - just do a few tests on your own and i'm sure you'll understand pretty fast what it does


RE: Database updates for live application - Sentro - 11-12-2015

It's just that we are about to leave the beta and i've already abandoned one and about to abandon another method for updating and don't really wanna go live and the having to change it again in a few weeks.

Thank you though, that's the way i'll probably follow.


RE: Database updates for live application - skunkbad - 11-12-2015

We mostly run our update queries manually at phpmyadmin's SQL tab. Each table (about 100) in our database has a log file, and we always know what happened and when. In 4 years, we've never needed to back out a change, and we've also never needed to look back. In our case, using migrations or something else would just be a waste of time.


RE: Database updates for live application - sintakonte - 11-12-2015

that depends - we experienced the problem of the centralization
each developer who changes the db can do this, but our problem was to organize that
and in order to organize that you need something centralized and automated

we have our entire database in our CI migration environment
each time we change something we do it in this migration script commit to the svn/git rep and any other developer can use it without much effort on his local environment