Download the PHP package filipe07/php-database-migration without Composer
On this page you can find all versions of the php package filipe07/php-database-migration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download filipe07/php-database-migration
More information about filipe07/php-database-migration
Files in filipe07/php-database-migration
Package php-database-migration
Short Description SQL migration tool forked from https://github.com/alwex/php-database-migration
License MIT
Homepage https://github.com/filipe07/php-database-migration
Informations about the package php-database-migration
PhpMySQLMigration - PHP-MySQL database migration tool
Project created to run migrations on multiple environments
This is a full standalone PHP tool based on Symfony Console. It's a fork from https://github.com/alwex/php-database-migration
Usage
Installing it in your project
Just run composer command (don't forget to specify your bin directory)
Initialization
Choose folder for migrations and configurations and creates a new database table for tracking the current database changes.
Warning, all migrate commands must be executed on your root folder like bin/migrate migrate:command...
Adding an environment
The first thing to do before playing with MySQL migrations is to add an environment, let's add the dev one.
You will be prompted to answer a series of questions about your environment, and then a config file will be saved
in .[environments]/[env].yml
.
Create a migration
It is time to create our first migration file.
Migrations file are like this: -- // add table users -- Migration SQL that makes the change goes here. create table users (id integer, name text); -- @UNDO -- SQL to undo the change goes here. drop table users;
List status of migrations
View all available migrations and their status.
Up and down
You can now up all the pending migrations. If you decide to down a migration, the last one will be downed alone to prevent mistakes. You will be asked to confirm the downgrade of your database before running the real SQL script.
For development purposes, it is also possible to up a single migration without taking care of the other ones:
or migrate to specific migration (it will run all migrations, including the specified migration)
Same thing for down:
or
Seed file to database
If you need to seed database with given file
All versions of php-database-migration with dependencies
symfony/console Version ~2.6|~3.0
symfony/process Version ~2.6|~3.0
symfony/config Version ~2.6|~3.0
cocur/slugify Version ~1.0
symfony/yaml Version ~2.6|~3.0