| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- declare(strict_types=1);
- use Phinx\Migration\AbstractMigration;
- final class FilesystemUserFile 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('filesystem_user_file', [
- 'comment' => '文件表',
- 'engine' => 'InnoDB',
- 'collation' => 'utf8mb4_general_ci',
- 'id' => false,
- 'primary_key' => 'id'
- ]);
- $table
- ->addColumn('id', 'integer', [
- 'identity' => true,
- 'signed' => false,
- 'comment' => '主键'
- ])
- ->addColumn('user_id', 'integer', [
- 'default' => 0,
- 'signed' => false,
- 'comment' => '用户id'
- ])
- ->addColumn('file_hash', 'string', [
- 'default' => '',
- 'comment' => '文件hash'
- ])->addColumn('name', 'string', [
- 'default' => '',
- 'comment' => '文件备注名称'
- ])->addColumn('file_name', 'string', [
- 'default' => '',
- 'comment' => '文件名'
- ])->addColumn('file_path', 'string', [
- 'default' => '',
- 'comment' => '文件路径'
- ])->addColumn('file_size', 'integer', [
- 'default' => 0,
- 'comment' => '文件大小'
- ])->addColumn('file_ext', 'string', [
- 'default' => '',
- 'comment' => '文件类型'
- ])->addColumn('file_mine', 'string', [
- 'default' => '',
- 'comment' => '文件MIME'
- ])->addColumn('file_url', 'string', [
- 'default' => '',
- 'comment' => '文件URL'
- ])->addTimestamps('create_time', 'update_time')
- ->addColumn('delete_time', 'timestamp', [
- 'null' => true,
- 'comment' => '删除时间'
- ])->addIndex('file_hash', [
- 'name' => 'file_hash'
- ])->create();
- }
- }
|