Welcome Guest, Not a member yet? Register   Sign In
MySQL backups
#1

[eluser]dmorin[/eluser]
I've been working with the MySQL backup functionality in the Utilities Class and I noticed a few things that I wanted to mention for the good of the group. First, unless you're really lucky, any foreign key constraints you have may cause table creation to fail when recreating the db from a backup. Adding this to the top of the file fixes it:

Code:
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;

Next, because field names aren't ticked (`name`) in the insert queries, if you use reserved words in your field names, it will fail to insert the records (i.e. user-agent). This appears to only happen with a dash not an underscore (user-agent versus user_agent).

Moral of the story, if you're using the CI DB Utilities Class to make backups, verify that you can actually restore them (applies to all backups of course...).




Theme © iAndrew 2016 - Forum software by © MyBB