All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 3s
34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
|
|
use think\migration\Seeder;
|
|
|
|
class ProductCompatPartsInit 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, 'name' => '机械硬盘', 'sort' => 1, 'disabled' => 0],
|
|
['id' => 2, 'language_id' => 1, 'name' => '2.5 寸固态硬盘', 'sort' => 2, 'disabled' => 0],
|
|
['id' => 3, 'language_id' => 1, 'name' => 'M.2 固态硬盘', 'sort' => 3, 'disabled' => 0],
|
|
['id' => 4, 'language_id' => 1, 'name' => '内存条', 'sort' => 4, 'disabled' => 0],
|
|
['id' => 5, 'language_id' => 1, 'name' => 'UPS 不间断电源', 'sort' => 5, 'disabled' => 0]
|
|
];
|
|
|
|
$table = $this->table('product_compat_parts');
|
|
|
|
// empty the table
|
|
$table->truncate();
|
|
|
|
// insert data
|
|
$table->insert($data)->saveData();
|
|
}
|
|
}
|