Files
dafuweng/db/migrations/20231019082149_create_admin_configs.php
2026-03-02 13:44:38 +08:00

34 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Db\Adapter\MysqlAdapter;
use Phinx\Migration\AbstractMigration;
final class CreateAdminConfigs extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change(): void
{
$exists = $this->hasTable('admin_configs');
if (!$exists) {
$table = $this->table('admin_configs', ['comment' => '系统配置表']);
$table->addColumn('name', 'string', ['limit' => 100, 'null' => false, 'default' => '', 'comment' => '配置字段'])
->addColumn('value', 'text', ['limit' => MysqlAdapter::TEXT_MEDIUM, 'comment' => '工控返回'])
->addColumn('created_at', 'datetime', ['comment' => '创建时间'])
->addColumn('updated_at', 'datetime', ['comment' => '更新时间'])
->create();
}
}
}