--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Добавляет поле is_feed_active в таблицу matrix_erp
+ */
+class m251002_140000_add_is_feed_active_to_matrix_erp_table extends Migration
+{
+ /**
+ * {@inheritdoc}
+ */
+ const TABLE_NAME = 'erp24.matrix_erp';
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $tableSchema = $this->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');
+ }
+ }
+}
* @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
{
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],
'created_at' => 'Created At',
'updated_admin_id' => 'Updated Admin ID',
'updated_at' => 'Updated At',
+ 'is_feed_active' => 'Фид товаров',
];
}