2017 © Pedro Peláez
 

library phinx-migrations-generator

Migration generator for Phinx

image

odan/phinx-migrations-generator

Migration generator for Phinx

  • Monday, July 9, 2018
  • by odan
  • Repository
  • 12 Watchers
  • 80 Stars
  • 18,516 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 16 Forks
  • 1 Open issues
  • 38 Versions
  • 31 % Grown

The README.md

Phinx migrations generator

Generates Phinx migrations by comparing your current database with your schema information., (*1)

Latest Version on Packagist Software License Build Status Code Coverage Quality Score Total Downloads, (*2)

Requirements

  • PHP 8.1, 8.2

Features

  • Framework independent
  • DBMS: MySQL 5.7+, MySQL 8, MariaDB (partially supported)
  • Initial schema
  • Schema difference
  • Database: character set, collation
  • Tables: create, update, remove, engine, comment, character set, collation
  • Columns: create, update, remove
  • Indexes: create, remove
  • Foreign keys: create, remove, constraint name

Install

Via Composer, (*3)

composer require odan/phinx-migrations-generator --dev

Usage

Generating migrations

The first run generates an initial schema and a migration class. The file schema.php contains the previous database schema and is compared with the current schema. Based on the difference, a Phinx migration class is generated., (*4)

vendor/bin/phinx-migrations generate

When the generate command is executed again, only the difference to the last schema is generated., (*5)

Parameters

Parameter Values Default Description
--name string The class name.
--overwrite bool Overwrite schema.php file.
--path string (from phinx) Specify the path in which to generate this migration.
--environment or -e string (from phinx) The target environment.
--configuration or -c string (from phinx) The configuration file e.g. config/phinx.php

Running migrations

The Phinx migrate command runs all the available migrations., (*6)

vendor/bin/phinx migrate

Configuration

The phinx-migrations-generator uses the configuration of phinx., (*7)

Migration configuration

Parameter Values Default Description
foreign_keys bool false Enable or disable foreign key migrations.
default_migration_prefix string null If specified, in the absence of the name parameter, the default migration name will be offered with this prefix and a random hash at the end.
generate_migration_name bool false If enabled, a random migration name will be generated. The user will not be prompted for a migration name anymore. The parameter default_migration_prefix must be specified. The --name parameter can overwrite this setting.
mark_generated_migration bool true Enable or disable marking the migration as applied after creation.
migration_base_class string \Phinx\Migration\AbstractMigration Sets up base class of created migration.
schema_file string %%PHINX_CONFIG_DIR%%/db/ migrations/schema.php Specifies the location for saving the schema file.

Example configuration

Filename: phinx.php (in your project root directory), (*8)

<?php

// Framework bootstrap code here
require_once __DIR__ . '/config/bootstrap.php';

// Get PDO object
$pdo = new PDO(
    'mysql:host=127.0.0.1;dbname=test;charset=utf8mb4', 'root', '',
    array(
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_PERSISTENT => false,
        PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci',
    )
);

return [
    'paths' => [
        'migrations' => __DIR__ . '/../resources/migrations',
    ],
    'schema_file' => __DIR__ . '/../resources/schema/schema.php',
    'foreign_keys' => false,
    'default_migration_prefix' => '',
    'mark_generated_migration' => true,
    'environments' => [
        'default_environment' => 'local',
        'local' => [
            // Database name
            'name' => $pdo->query('select database()')->fetchColumn(),
            'connection' => $pdo,
        ]
    ]
];

Testing

composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details., (*9)

License

The MIT License (MIT). Please see License File for more information., (*10)

The Versions

09/07 2018

dev-master

9999999-dev https://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migrations generator migration mysql mariadb phinx

09/07 2018

3.0.1

3.0.1.0 https://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migrations generator migration mysql mariadb phinx

03/07 2018

3.0.0

3.0.0.0 https://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migrations generator migration mysql mariadb phinx

12/06 2018

2.7.0

2.7.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migrations generator migration mysql phinx

23/05 2018

2.6.2

2.6.2.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migrations generator migration mysql phinx

11/04 2018

2.6.1

2.6.1.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migrations generator migration mysql phinx

14/03 2018

2.6.0

2.6.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

26/02 2018

2.5.0

2.5.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

23/02 2018

2.4.0

2.4.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

25/10 2017

2.3.1

2.3.1.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

24/10 2017

2.3.0

2.3.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

16/10 2017

2.2.0

2.2.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

20/06 2017

2.1.4

2.1.4.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

03/06 2017

2.1.2

2.1.2.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

22/05 2017

2.1.1

2.1.1.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

06/05 2017

2.1.0

2.1.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

02/05 2017

2.0.0

2.0.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

19/04 2017

1.2.0

1.2.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

10/04 2017

1.1.0

1.1.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

05/04 2017

1.0.0

1.0.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

07/03 2017

0.7.0

0.7.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

04/03 2017

0.6.4

0.6.4.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

17/02 2017

0.6.3

0.6.3.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

31/01 2017

0.6.2

0.6.2.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

22/01 2017

0.6.1

0.6.1.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

17/12 2016

0.6.0

0.6.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

10/12 2016

0.5.1

0.5.1.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

10/12 2016

0.5.0

0.5.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

09/12 2016

0.4.4

0.4.4.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

09/12 2016

0.4.3

0.4.3.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

09/12 2016

0.4.2

0.4.2.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

09/12 2016

0.4.1

0.4.1.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

09/12 2016

0.4.0

0.4.0.0 http://github.com/odan/phinx-migrations-generator

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

03/12 2016

0.3.0

0.3.0.0 http://github.com/odan/migration

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

20/09 2016

0.2.0

0.2.0.0 http://github.com/odan/migration

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

17/07 2016

0.1.0

0.1.0.0 http://github.com/odan/migration

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

11/07 2016

0.0.2

0.0.2.0 http://github.com/odan/migration

Migration generator for Phinx

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx

09/07 2016

0.0.1

0.0.1.0 http://github.com/odan/migration

Migration generator

  Sources   Download

MIT

The Requires

 

The Development Requires

database migration phinx