PHP code example of webman-micro / migrations

1. Go to this page and download the library: Download webman-micro/migrations 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/ */

    

webman-micro / migrations example snippets


composer 


return [
    'enable' => true,
    "paths" => [
        "migrations" => "database/migrations", // 迁移文件存储路径
        "seeds" => "database/seeders" // 迁移数据文件存在路径
    ],
    "environments" => [
        "default_migration_table" => "phinxlog", // 迁移记录表
        "default_environment" => "product", // 默认使用的环境配置
        "product" => [
            "adapter" => "mysql", // 使用mysql 配置
            "host" => getenv("DB_HOST", '127.0.0.1'),
            "name" => getenv("DB_NAME", ''),
            "user" => getenv("DB_USER", ''),
            "pass" => getenv("DB_PASSWORD", ''),
            "port" => getenv("DB_PORT", '3306'),
            "charset" => "utf8"
        ]
    ]
];


.
├── app                           应用目录
│   ├── controller                控制器目录
│   │   └── Index.php             控制器
│   ├── model                     模型目录
......
├── database                      数据库文件
│   ├── migrations                迁移文件
│   │   └── 20180426073606_create_user_table.php
│   ├── seeders                   迁移数据
│   │   └── UserSeeder.php
......

$ php webman migrations:create MyNewMigration

$ php webman migrations:create MyNewMigration --template="<file>"

$ php webman migrations:create MyNewMigration --class="<class>"

$ php webman seed:create MyNewSeeder