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

35 lines
1.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
use Phinx\Db\Adapter\MysqlAdapter;
use Phinx\Migration\AbstractMigration;
final class CreateAdminFileAttachmentCates 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_file_attachment_cates');
if (!$exists) {
$table = $this->table('admin_file_attachment_cates', ['comment' => '系统附件分类']);
$table->addColumn('name', 'string', ['limit' => 100, 'null' => false, 'default' => '', 'comment' => '分类名称'])
->addColumn('pid', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'signed' => false, 'null' => false, 'default' => 0, 'comment' => '上级id'])
->addColumn('permission_type', 'integer', ['limit' => MysqlAdapter::INT_TINY, 'null' => false, 'default' => 0, 'comment' => '0所有人1仅自己'])
->addColumn('sort', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('admin_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'signed' => false, 'null' => false, 'default' => 0, 'comment' => '后台用户id'])
->create();
}
}
}