30 lines
954 B
PHP
30 lines
954 B
PHP
<?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();
|
|
}
|
|
} |