automateddatabasemigration Automated generation of migration files


This allows a distributed team to easily update the db locally and then distribute it's updates with the other developers automatically with the rest of the code via a versioning control system (I used git).

-> Download

Further reading

This tool exports and generates the full db in xml format and migration code (safeUp/safeDown) for:

  • initial full db;
  • added/dropped tables, columns, and foreign keys (and fks related indexes);
  • updated column attributes the following modified column attributes are detected and exported:
  • type, length, zerofill, allow null, default value
    Please note:
  • indexes are not automatically exported;
  • new and dropped foreign keys generate or remove linked indexes automatically in the migration file if $GENERATE_FK_IDX is set to true
  • columns renamed are considered drop columns and add addd new columns;
  • column unsigned and comments are not automatically exported;
  • the foreign key name exported is not a match with the one from the db, but based on the naming convention
    Final notes:
  • see the Wiki for run instructions
  • to automate the migration after a git pull, use this code in your .git/hooks folder. Don't forget to read the README file
  • please feel free to send me improvements or comments to this code as I know it's not perfect :)
  • this project was inspired by this code from bmarston
1 0
1 follower
Yii Version: 1.1
License: (not set)
Category: Others
Developed by: ponte
Created on: Sep 4, 2014
Last updated: 9 years ago

Related Extensions