refactor: 处理优化migration文件与model文件字段不一致

This commit is contained in:
2025-06-12 17:41:14 +08:00
parent 736bf19cd6
commit 7eac43e146
13 changed files with 58 additions and 19 deletions

View File

@@ -0,0 +1,30 @@
<?php
use think\migration\Seeder;
class ProductAttrInit extends Seeder
{
/**
* Run Method.
*
* Write your database seeder using this method.
*
* More information on writing seeders is available here:
* http://docs.phinx.org/en/latest/seeding.html
*/
public function run(): void
{
$data = [
['id' => 1, 'language_id' => 1, 'attr_type' => 1, 'attr_name' => '颜色', 'is_system' => 1, 'created_at' => '2025-02-12 10:11:05', 'updated_at' => '2025-03-28 16:17:46', 'deleted_at' => null],
['id' => 2, 'language_id' => 2, 'attr_type' => 1, 'attr_name' => 'Color', 'is_system' => 1, 'created_at' => '2025-02-12 10:11:05', 'updated_at' => '2025-05-26 11:08:55', 'deleted_at' => null]
];
$table = $this->table('product_attr');
// empty the table
$table->truncate();
// insert data
$table->insert($data)->saveData();
}
}