2017 © Pedro PelĂĄez
 

library pdo-simple-migration

Database version control using PDO connection

image

fabiopaiva/pdo-simple-migration

Database version control using PDO connection

  • Saturday, February 13, 2016
  • by fabiopaiva1
  • Repository
  • 2 Watchers
  • 4 Stars
  • 65 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

PDO Simple Migration

Simple migration is a minimalist tool to manage your database versioning., (*1)

Installation

composer require fabiopaiva/pdo-simple-migration

Installation, (*2)

Configuration

This library tries to find a file called config.php in working directory with PDO setup, if file doesn't exist, you can send PDO parameters in command line., (*3)

config.php (optional)

``` php <?php return [ 'db' => [ 'dsn' => 'mysql:host=localhost;dbname=myDb;port=3306;charset=UTF8', 'username' => 'root', 'password' => 'pass', ], 'table' => 'migrations', 'dir' => 'migrations' ];, (*4)


`table` is the name of database table to control your versioning, migrations is default. `dir` is the path where you want to store you migrations file. ## Usage ### Status List current status of your migrations vendor/bin/migration status ![Status](https://github.com/fabiopaiva/PDOSimpleMigration/blob/master/docs/status.png) ### Generate Generate a empty migration vendor/bin/migration generate ![Generate](https://github.com/fabiopaiva/PDOSimpleMigration/blob/master/docs/generate.png) #### Generated code example ``` php <?php namespace PDOSimpleMigration\Migrations; use PDOSimpleMigration\Library\AbstractMigration; class Version20160128130854 extends AbstractMigration { public static $description = "Migration description"; public function up() { //$this->addSql(/*Sql instruction*/); } public function down() { //$this->addSql(/*Sql instruction*/); } }

Migrate

Migrate to latest version, (*5)

vendor/bin/migration migrate

Migrate, (*6)

Execute

Execute specific migration version (up or down), (*7)

vendor/bin/migration execute version --up --down

Execute, (*8)

Options

--dump

If --dump parameter is present, migration will only dump query in screen, (*9)

--dsn and --username

If you don't want to create config.php file, you can send --dsn setup parameter. If you send --dsn parameter, you need to send --username parameter too. The prompt will ask your database password., (*10)

--dir

Directory where to save migrations classes, default migrations, (*11)

--table

Table where to store migrations versioning history, default migrations, (*12)

Issues

Please report issues to Github Issue Tracker, (*13)

The Versions

13/02 2016

dev-master

9999999-dev

Database version control using PDO connection

  Sources   Download

MIT

The Requires

 

The Development Requires

postgresql migration pdo mysql db versioning

13/02 2016

0.1.2

0.1.2.0

Database version control using PDO connection

  Sources   Download

MIT

The Requires

 

The Development Requires

postgresql migration pdo mysql db versioning

29/01 2016

0.1.1

0.1.1.0

Database version control using PDO connection

  Sources   Download

MIT

The Requires

 

The Development Requires

postgresql migration pdo mysql db versioning

29/01 2016

0.1

0.1.0.0

Database version control using PDO connection

  Sources   Download

MIT

The Requires

 

The Development Requires

postgresql migration pdo mysql db versioning