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

35 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Db\Adapter\MysqlAdapter;
use Phinx\Migration\AbstractMigration;
final class CreateActivityContent 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
{
$table = $this->table('activity_content', ['comment' => '活动内容']);
$table->addColumn('name', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '活动名称'])
->addColumn('activity_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '活动ID'])
->addColumn('lang', 'string', ['limit' => 20, 'null' => false, 'default' => '', 'comment' => '语言标识'])
->addColumn('link', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '连接地址'])
->addColumn('picture', 'string', ['limit' => 255, 'null' => false, 'default' => '', 'comment' => '主图'])
->addColumn('created_at', 'timestamp', ['comment' => '创建时间'])
->addColumn('updated_at', 'timestamp', ['comment' => '更新时间'])
->addIndex(['activity_id'], ['name' => 'idx_activity_id'])
->create();
}
}