From 8c0019efb3c12b0c0d063e7b9a88c6c2f5ac3901 Mon Sep 17 00:00:00 2001 From: Aleksey Filippov Date: Fri, 19 Jul 2024 10:00:56 +0300 Subject: [PATCH] =?utf8?q?=D0=A2=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D0=B0=20?= =?utf8?q?=D0=B4=D0=BB=D1=8F=20=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8?= =?utf8?q?=D1=8F=20=D0=BC=D0=BE=D1=82=D0=B8=D0=B2=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ...m240719_063451_create_table_motivation.php | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 erp24/migrations/m240719_063451_create_table_motivation.php diff --git a/erp24/migrations/m240719_063451_create_table_motivation.php b/erp24/migrations/m240719_063451_create_table_motivation.php new file mode 100755 index 00000000..f1a775fd --- /dev/null +++ b/erp24/migrations/m240719_063451_create_table_motivation.php @@ -0,0 +1,66 @@ +createTable(self::TABLE_NAME, [ + 'id' => $this->primaryKey(), + 'store_id' => $this->integer()->notNull()->comment('ID магазина'), + 'year' => $this->integer()->notNull()->comment('Год'), + 'month' => $this->integer()->notNull()->comment('Месяц'), + 'updated_at' => $this->datetime()->notNull()->comment('Дата изменения записи'), + 'created_at' => $this->datetime()->notNull()->comment('Дата создания записи'), + ]); + + $this->createTable(self::TABLE_NAME2, [ + 'id' => $this->primaryKey(), + 'motivation_id' => $this->integer()->notNull()->comment('ID motivation'), + 'motivation_group_id' => $this->integer()->notNull()->comment('ID motivation'), + 'value_id' => $this->integer()->notNull()->comment('ID motivation'), + 'value_type' => $this->string(10)->notNull()->comment('тип значения'), + 'value_int' => $this->integer()->null()->comment('value int'), + 'value_float' => $this->float()->null()->comment('value float'), + 'value_string' => $this->string()->null()->comment('value string'), + ]); + + $this->createTable(self::TABLE_NAME3, [ + 'id' => $this->primaryKey(), + 'name' => $this->string(80)->notNull()->comment('Название'), + 'alias' => $this->string(80)->notNull()->comment('Алиас'), + ]); + + $this->batchInsert(self::TABLE_NAME3, ['id', 'name', 'alias'], [ + [1, 'Неделя 1', 'week1'], + [2, 'Неделя 2', 'week2'], + [3, 'Неделя 3', 'week3'], + [4, 'Неделя 4', 'week4'], + [5, 'Неделя 5', 'week5'], + [6, 'Факт', 'fact'], + [7, 'План', 'plan'], + [8, 'Корректировка', 'adjustment'], + ]); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropTable(self::TABLE_NAME3); + $this->dropTable(self::TABLE_NAME2); + $this->dropTable(self::TABLE_NAME); + } +} -- 2.39.5