PHP code example of jamband / yii2-schemadump

1. Go to this page and download the library: Download jamband/yii2-schemadump 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/ */

    

jamband / yii2-schemadump example snippets


return [
    ...
    'components' => [
        ...
    ],
    'controllerMap' => [
        'migrate' => [
            'class' => yii\console\controllers\MigrateController::class,
            'templateFile' => '@jamband/schemadump/template.php',
        ],
        'schemadump' => [
            'class' => jamband\schemadump\SchemaDumpController::class,
            'db' => [
                'class' => yii\db\Connection::class,
                'dsn' => 'mysql:host=localhost;dbname=existing_database_name',
                'username' => 'your_username',
                'password' => 'your_password',
            ],
        ],
    ],
    ...
];

// user
$this->createTable('{{%user}}', [
    'id' => $this->primaryKey()->comment('主キー'),
    'username' => $this->string(20)->notNull()->unique()->comment('ユーザ名'),
    'email' => $this->string(255)->notNull()->unique()->comemnt('メールアドレス'),
    'password' => $this->string(255)->notNull()->comment('パスワード'),
], $this->tableOptions);