]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Создал таблицы
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Sat, 2 Nov 2024 13:52:54 +0000 (16:52 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Sat, 2 Nov 2024 13:52:54 +0000 (16:52 +0300)
erp24/migrations/m241102_124933_create_product_1c_prop_type_table.php [new file with mode: 0644]
erp24/migrations/m241102_124956_create_product_1c_prop_value_table.php [new file with mode: 0644]

diff --git a/erp24/migrations/m241102_124933_create_product_1c_prop_type_table.php b/erp24/migrations/m241102_124933_create_product_1c_prop_type_table.php
new file mode 100644 (file)
index 0000000..97cce87
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%product_1c_prop_type}}`.
+ */
+class m241102_124933_create_product_1c_prop_type_table extends Migration
+{
+
+    const TABLE_NAME = 'erp24.product_1c_prop_type';
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $this->createTable(self::TABLE_NAME, [
+            'id' => $this->string()->notNull()->unique()->comment('Идентификатор из 1С'),
+            'alias' => $this->string()->notNull()->comment('Алиас свойства'),
+            'value' => $this->string()->notNull()->comment('Значение - например, "Срезка"'),
+        ]);
+
+        $this->addPrimaryKey('pk_product_1c_prop_type', self::TABLE_NAME, 'id');
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->dropTable(self::TABLE_NAME);
+    }
+}
diff --git a/erp24/migrations/m241102_124956_create_product_1c_prop_value_table.php b/erp24/migrations/m241102_124956_create_product_1c_prop_value_table.php
new file mode 100644 (file)
index 0000000..ca1ab18
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%product_1c_prop_value}}`.
+ */
+class m241102_124956_create_product_1c_prop_value_table extends Migration
+{
+
+    const TABLE_NAME = 'erp24.product_1c_prop_value';
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $this->createTable(self::TABLE_NAME, [
+            'id' => $this->string()->notNull()->unique()->comment('Идентификатор значения в системе 1С'),
+            'prop_id' => $this->string()->notNull()->comment('Идентификатор свойства для которого присваивается значение'),
+            'value_type' => $this->string()->notNull()->comment('Тип данных значения'),
+            'value_string' => $this->string()->null()->comment('String '),
+            'value_int' => $this->integer()->null()->comment('Integer'),
+            'value_float' => $this->float()->null()->comment('Float'),
+        ]);
+
+        $this->addPrimaryKey('pk_product_1c_prop_value', self::TABLE_NAME, 'id');
+        $this->addForeignKey(
+            'fk_product_1c_prop_value_prop_id',
+            self::TABLE_NAME,
+            'prop_id',
+            '{{%erp24.product_1c_prop_type}}',
+            'id',
+            'CASCADE',
+            'CASCADE'
+        );
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->dropForeignKey('fk_product_1c_prop_value_prop_id', self::TABLE_NAME);
+        $this->dropTable(self::TABLE_NAME);
+
+    }
+}