]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Добавление поля check_id_last_sale в Users
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 4 Feb 2025 15:02:01 +0000 (18:02 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 4 Feb 2025 15:02:01 +0000 (18:02 +0300)
erp24/migrations/m250204_143849_add_column_check_id_last_sale_to_user_table.php [new file with mode: 0644]

diff --git a/erp24/migrations/m250204_143849_add_column_check_id_last_sale_to_user_table.php b/erp24/migrations/m250204_143849_add_column_check_id_last_sale_to_user_table.php
new file mode 100644 (file)
index 0000000..5cfa8d1
--- /dev/null
@@ -0,0 +1,58 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m250204_143849_add_column_check_id_last_sale_to_user_table
+ */
+class m250204_143849_add_column_check_id_last_sale_to_user_table extends Migration
+{
+    const TABLE_NAME  = 'erp24.users';
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        if ($this->db->schema->getTableSchema(self::TABLE_NAME) === null) {
+            return;
+        }
+
+        if ($this->db->schema->getTableSchema(self::TABLE_NAME)->getColumn('check_id_last_sale') === null) {
+            $this->addColumn(
+                self::TABLE_NAME,
+                'check_id_last_sale',
+                $this->string()->null()->comment('GUID последнего чека'),
+            );
+        }
+
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        if ($this->db->schema->getTableSchema(self::TABLE_NAME) === null) {
+            return;
+        }
+
+        if ($this->db->schema->getTableSchema(self::TABLE_NAME)->getColumn('check_id_last_sale') !== null) {
+            $this->dropColumn(self::TABLE_NAME, 'check_id_last_sale');
+        }
+    }
+
+    /*
+    // Use up()/down() to run migration code without a transaction.
+    public function up()
+    {
+
+    }
+
+    public function down()
+    {
+        echo "m250204_143849_add_column_check_id_last_sale_to_user_table cannot be reverted.\n";
+
+        return false;
+    }
+    */
+}