File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,20 +4,42 @@ PhpDbMigration - full PHP database migration tool
44This is a full standalone PHP tool based on symfony console and inspired by the rails database migration tool and MyBatis.
55It merge the functionnality of the two tools and has been desined to be as flexible as possible.
66
7- Add an environment
8- ------------------
7+ Adding an environment
8+ ---------------------
9+ The first thing to do before playing with SQL migrations is to add an environment, let's add the dev one.
10+
911![ alt tag] ( http://tikotepadventure.com/files/php-database-migration/addenv.gif )
1012
1113Initialization
1214--------------
15+ Once the environment is added, you have to initialize it (create the changelog table on the good database)
16+
1317![ alt tag] ( http://tikotepadventure.com/files/php-database-migration/init.gif )
1418
1519Create a migration
1620------------------
21+ It is time to create our first migration file.
22+
1723![ alt tag] ( http://tikotepadventure.com/files/php-database-migration/create.gif )
1824
25+ Migrations file are like this
26+
27+ --// add table users
28+ -- Migration SQL that makes the change goes here.
29+ create table users (id integer, name text);
30+ -- @UNDO
31+ -- SQL to undo the change goes here.
32+ drop table users;
33+
1934Up and down
2035------------------
36+ You can now up all the pending migrations. If you decided to down a migration, the last one will be downed alone to prevent from mistake. You will be asked to confirm the downgrade of your database before runing the real SQL script.
2137![ alt tag] ( http://tikotepadventure.com/files/php-database-migration/status.gif )
38+
39+ For developement purpose, it is also possible to up a single migration without taking care of the other ones.
40+
2241![ alt tag] ( http://tikotepadventure.com/files/php-database-migration/uponly.gif )
42+
43+ Same thing for down
44+
2345![ alt tag] ( http://tikotepadventure.com/files/php-database-migration/downonly.gif )
You can’t perform that action at this time.
0 commit comments