From: Vladimir Fomichev Date: Thu, 2 Oct 2025 11:46:41 +0000 (+0300) Subject: Миграция X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=9e987f6e790429c2234744352d2f195cc416a154;p=erp24_rep%2Fyii-erp24%2F.git Миграция --- diff --git a/erp24/migrations/m251002_140000_add_is_feed_active_to_matrix_erp_table.php b/erp24/migrations/m251002_140000_add_is_feed_active_to_matrix_erp_table.php new file mode 100644 index 00000000..947b2902 --- /dev/null +++ b/erp24/migrations/m251002_140000_add_is_feed_active_to_matrix_erp_table.php @@ -0,0 +1,38 @@ +db->getTableSchema(self::TABLE_NAME); + + if (isset($tableSchema) && !isset($tableSchema->columns['is_feed_active'])) { + $this->addColumn(self::TABLE_NAME, 'is_feed_active', $this->tinyInteger()->defaultValue(0)->comment('Флаг помечающий что эта запись попадет в фид товаров')); + } + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $tableSchema = $this->db->getTableSchema(self::TABLE_NAME); + + if (isset($tableSchema) && isset($tableSchema->columns['is_feed_active'])) { + $this->dropColumn(self::TABLE_NAME, 'is_feed_active'); + } + } +} diff --git a/erp24/records/MatrixErp.php b/erp24/records/MatrixErp.php index 2d468f71..34727ca4 100644 --- a/erp24/records/MatrixErp.php +++ b/erp24/records/MatrixErp.php @@ -29,6 +29,7 @@ use yii_app\helpers\DataHelper; * @property int|null $updated_at * @property string|null $deleted_at * @property int|null $deleted_by + * @property int|null $is_feed_active */ class MatrixErp extends \yii\db\ActiveRecord { @@ -62,7 +63,7 @@ class MatrixErp extends \yii\db\ActiveRecord return [ [['guid', 'date_from'], 'required'], [['updated_at', 'created_at'], 'safe'], - [['category_id', 'active', 'created_admin_id', 'updated_admin_id'], 'integer'], + [['category_id', 'active', 'created_admin_id', 'updated_admin_id', 'is_feed_active'], 'integer'], [['components', 'deleted_at'], 'string'], [['id', 'deleted_by'], 'integer'], [['guid', 'parent_id', 'group_name', 'code', 'articule', 'date_from', 'date_to'], 'string', 'max' => 100], @@ -92,6 +93,7 @@ class MatrixErp extends \yii\db\ActiveRecord 'created_at' => 'Created At', 'updated_admin_id' => 'Updated Admin ID', 'updated_at' => 'Updated At', + 'is_feed_active' => 'Фид товаров', ]; }