From: fomichev Date: Sat, 2 Nov 2024 13:52:54 +0000 (+0300) Subject: Создал таблицы X-Git-Tag: 1.7~212^2~25 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=c14ff3b5380c357cb622f5d36d52bae615ee1a94;p=erp24_rep%2Fyii-erp24%2F.git Создал таблицы --- 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 index 00000000..97cce874 --- /dev/null +++ b/erp24/migrations/m241102_124933_create_product_1c_prop_type_table.php @@ -0,0 +1,33 @@ +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 index 00000000..ca1ab185 --- /dev/null +++ b/erp24/migrations/m241102_124956_create_product_1c_prop_value_table.php @@ -0,0 +1,47 @@ +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); + + } +}