8 * Класс создания таблицы `{{%items}}`.
9 * Учёт наименовний товаров
11 class m200804_115556_create_items_table extends Migration
16 public function safeUp()
18 $table = Items::tableName();
19 $this->createTable($table, [
21 'date' => $this->date()->comment('Дата внесения записи'),
22 'invent' => $this->string(50)->comment('Инвентарный номер'),
23 'serial' => $this->string(255)->comment('Серийный номер'),
24 'model' => $this->string(255)->comment('Модель оборудования'),
25 'mac' => $this->string(20)->comment('Сетевой MAC адрес'),
26 'name' => $this->string(255)->comment('Сетевое имя оборудования'),
27 'os' => $this->string(255)->comment('Операционная система'),
28 'product' => $this->string(255)->comment('Код оборудования'),
29 'modelnumber' => $this->string(255)->comment('Номер модели'),
31 $this->addPrimaryKey('id_pk', $table, 'id');
33 $this->addCommentOnTable( $table, 'Список оборудования');
34 $this->addCommentOnColumn($table, 'id', 'Идентификатор (неизменяемый)');
35 $this->insert($table, [
36 'name' => 'MTV-WS-0001',
37 'model' => 'HP ProOne 440 G5 23.8-in All-in-One',
38 'os' => 'Windows 10 Pro',
39 'mac' => '04:0e:3c:26:e3:2f',
40 'serial' => '8CG0117YPJ',
41 'product' => '7EM69EA#ACB',
42 'modelnumber' => 'TPC-W056-23 440G5POTeA/59500T/1hq/8G54fL24 RUSS',
43 'date' => '2020-07-31',
45 $this->insert($table, [
46 'name' => 'GOL-WS-0001',
47 'model' => 'HP ProOne 440 G5 23.8-in All-in-One',
48 'os' => 'Windows 10 Pro',
49 'mac' => '04:0e:3c:26:59:5b',
50 'serial' => '8CG0117XM1',
51 'product' => '7EM69EA#ACB',
52 'modelnumber' => 'TPC-W056-23 440G5POTeA/59500T/1hq/8G54fL24 RUSS',
53 'date' => '2020-07-31',
55 $this->insert($table, [
56 'name' => 'GOL-WS-0002',
57 'model' => 'HP ProOne 440 G5 23.8-in All-in-One',
58 'os' => 'Windows 10 Pro',
59 'mac' => '04:0e:3c:26:e3:03',
60 'serial' => '8CG0117ZH1',
61 'product' => '7EM69EA#ACB',
62 'modelnumber' => 'TPC-W056-23 440G5POTeA/59500T/1hq/8G54fL24 RUSS',
63 'date' => '2020-07-31',
70 public function safeDown()
72 $table = Items::tableName();
73 $this->dropPrimaryKey('id_pk', $table);
74 $this->dropTable($table);