Migrations are a type of version control for your database. They allow a team to modify the database schema and stay up to date on the current schema state. Migrations are typically paired with the Builder to easily manage your application's schema.
Please Note: Migrations in version 5.0.0 considered as (BETA version), So you may find drastic changes on commands in the next release of the library
Do not forget that you can help me develop the library by fork or send your suggestions on github
to create migration, you may use the migrate:make {migration_name} {migrate-type}
Command in phptricks
Migrate Type |
Description |
create |
migration to create new table |
alter |
migration to edit table schema |
drop |
migration to delete table |
# migration to create new table
php phptricks migrate:make MIGRATION_NAME create
# migration to change table schema
php phptricks migrate:make MIGRATION_NAME alter
# migration to delete table
php phptricks migrate:make MIGRATION_NAME drop
The migrations will be placed in your Migrations/{migration-type} folder, and will contain a sample code
initial code must not working without changes.
The --table
and -t
option may also be used to indicate the name of the table.
php phptricks migrate:make MIGRATION_NAME create --table=table_name
php phptricks migrate:make MIGRATION_NAME create -t=table_name
php phptricks migrate:make MIGRATION_NAME create -t table_name
Running All Outstanding Migrations
Running Creates Migrations Only
php phptricks migrate:create
Running Alters Migrations Only
php phptricks migrate:alter
Running Drops Migrations Only
php phptricks migrate:drop
Do you have any suggestion ?
feel free to contact me on < m.anzawi2013@gmail.com >
Fork On Github
Fork PHPtricks-ORM Library on Github and help me to develop something awesome