PHP code example of odan / phinx-migrations-generator

1. Go to this page and download the library: Download odan/phinx-migrations-generator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

odan / phinx-migrations-generator example snippets




// Framework bootstrap code here
'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,
        ]
    ]
];