Download the PHP package byjg/migration-cli without Composer
On this page you can find all versions of the php package byjg/migration-cli. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download byjg/migration-cli
More information about byjg/migration-cli
Files in byjg/migration-cli
Package migration-cli
Short Description Simple library in PHP for database version control. Supports Sqlite, MySql, Sql Server and Postgres.
License MIT
Informations about the package migration-cli
Database Migrations (Cli)
This is a simple library written in PHP for database version control. Currently supports Sqlite, MySql, Sql Server and Postgres.
Database Migration can be used as:
- Command Line Interface
- PHP Library to be integrated in your functional tests
- Integrated in you CI/CD indenpent of your programming language or framework.
Important Note
This package is the command line interface of ByJG PHP Migration. To get more information about the the project and how to please visit: https://github.com/byjg/migration
Installing
Running in the command line
Migration library creates the 'migrate' script. It has the follow syntax:
Commands
Basic Usage
The basic usage is:
The --path
specify where the base.sql and migrate scripts are located.
If you omitted the --path
it will assume the current directory. You can also
set the MIGRATE_PATH
environment variable with the base path
The uri://connection is the uri that represents the connection to the database. You can see here to know more about the connection string.
You can omit the uri parameter if you define it in the
MIGRATE_CONNECTION
environment variable and the parameter path with
MIGRATE_PATH
environment variable
Command: create
Create a empty directory structure with base.sql and migrations/up and migrations/down for migrations. This is useful for create from scratch a migration scheme.
Ex.
Command: install
If you already have a database but it is not controlled by the migration system you can use this method for install the required tables for migration.
Command: update
Will apply all necessary migrations to keep your database updated.
Update command can choose if up or down your database depending on your current database version. You can also specify a version:
Command: reset
Creates/replace a database with the "base.sql" and apply ALL migrations
Note on reset: You can disable the reset command by setting the environment variable
MIGRATE_DISABLE_RESET
to true: