Преглед на файлове

refactor(migrations): 统一数据库迁移文件格式

- 为所有迁移文件添加 declare(strict_types=1) 声明
- 移除旧版 Column 类的使用,改用数组配置方式定义字段
- 统一时间戳字段命名为 create_time 和 update_time
- 使用 addColumn 方法替代 addTimestamps 和 addSoftDelete
- 标准化字段定义参数格式,提升代码一致性
runphp преди 5 месеца
родител
ревизия
18606b4e20
променени са 1 файла, в които са добавени 6 реда и са изтрити 5 реда
  1. 6 5
      database/migrations/20250830123540_user_point.php

+ 6 - 5
database/migrations/20250830123540_user_point.php

@@ -1,7 +1,8 @@
 <?php
 
+declare(strict_types=1);
+
 use Phinx\Migration\AbstractMigration;
-use think\migration\db\Column;
 
 class UserPoint extends AbstractMigration
 {
@@ -34,10 +35,10 @@ class UserPoint extends AbstractMigration
             'id' => false,
             'comment' => '用户积分表',
         ]);
-        $table->addColumn('user_id', Column::INTEGER, ['signed' => false, 'comment' => '用户ID'])
-            ->addColumn('point', Column::INTEGER, ['signed' => true, 'default' => 0, 'comment' => '积分'])
-            ->addColumn('freeze_point', Column::INTEGER, ['signed' => true, 'default' => 0, 'comment' => '冻结积分'])
-            ->addTimestamps()
+        $table->addColumn('user_id', 'integer', ['signed' => false, 'comment' => '用户ID'])
+            ->addColumn('point', 'integer', ['signed' => true, 'default' => 0, 'comment' => '积分'])
+            ->addColumn('freeze_point', 'integer', ['signed' => true, 'default' => 0, 'comment' => '冻结积分'])
+            ->addTimestamps('create_time', 'update_time')
             ->create();