]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Feature filippov erp 84 motivation tables
authorMarina Zozirova <marina.zozirova@erp-flowers.ru>
Thu, 25 Jul 2024 08:13:09 +0000 (08:13 +0000)
committerMarina Zozirova <marina.zozirova@erp-flowers.ru>
Thu, 25 Jul 2024 08:13:09 +0000 (08:13 +0000)
erp24/migrations/m240719_063451_create_table_motivation.php [new file with mode: 0755]

diff --git a/erp24/migrations/m240719_063451_create_table_motivation.php b/erp24/migrations/m240719_063451_create_table_motivation.php
new file mode 100755 (executable)
index 0000000..67e2328
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m240719_063451_create_table_motivation
+ */
+class m240719_063451_create_table_motivation extends Migration
+{
+    const TABLE_NAME = "erp24.motivation";
+    const TABLE_NAME2 = "erp24.motivation_value";
+    const TABLE_NAME3 = "erp24.motivation_value_group";
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $this->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);
+    }
+}