From: Marina Zozirova Date: Thu, 25 Jul 2024 08:13:09 +0000 (+0000) Subject: Feature filippov erp 84 motivation tables X-Git-Tag: 1.4~60^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=2be67211fa1226e92eb0b93b4de7b2dbf43e3ee5;p=erp24_rep%2Fyii-erp24%2F.git Feature filippov erp 84 motivation tables --- 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..67e23283 --- /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); + } +}