From: fomichev Date: Tue, 4 Feb 2025 07:03:06 +0000 (+0300) Subject: Добавление поля bonus_level в Users X-Git-Tag: 1.7~16^2~6 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=daca40f64e84b035ade6f1d66e21ccc824877453;p=erp24_rep%2Fyii-erp24%2F.git Добавление поля bonus_level в Users --- diff --git a/erp24/migrations/m250204_065535_add_column_bonus_level_to_users_table.php b/erp24/migrations/m250204_065535_add_column_bonus_level_to_users_table.php new file mode 100644 index 00000000..36882c54 --- /dev/null +++ b/erp24/migrations/m250204_065535_add_column_bonus_level_to_users_table.php @@ -0,0 +1,58 @@ +db->schema->getTableSchema(self::TABLE_NAME) === null) { + return; + } + + if ($this->db->schema->getTableSchema(self::TABLE_NAME)->getColumn('bonus_level') === null) { + $this->addColumn( + self::TABLE_NAME, + 'bonus_level', + $this->string()->null()->comment('Уровань клиента в БС'), + ); + } + + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + if ($this->db->schema->getTableSchema(self::TABLE_NAME) === null) { + return; + } + + if ($this->db->schema->getTableSchema(self::TABLE_NAME)->getColumn('bonus_level') !== null) { + $this->dropColumn(self::TABLE_NAME, 'bonus_level'); + } + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m250204_065535_add_column_bonus_level_to_users_table cannot be reverted.\n"; + + return false; + } + */ +} diff --git a/erp24/records/Users.php b/erp24/records/Users.php index c36834be..797b4f59 100755 --- a/erp24/records/Users.php +++ b/erp24/records/Users.php @@ -67,6 +67,7 @@ use yii\helpers\BaseConsole; * @property int $events Импортированы ли события * @property string|null $first_minus_balance * @property string $info + * @property string|null $bonus_level Уровань клиента в БС */ class Users extends \yii\db\ActiveRecord { @@ -182,7 +183,7 @@ class Users extends \yii\db\ActiveRecord 'store_id', 'first_minus_balance', 'telegram_unsubscribed_at', - + 'bonus_level', ], 'safe' ], @@ -217,7 +218,7 @@ class Users extends \yii\db\ActiveRecord [['comment', 'sale_store'], 'string', 'max' => 200], [['email'], 'string', 'max' => 70], [['phone_old'], 'string', 'max' => 250], - [['card', 'check_id'], 'string', 'max' => 35], + [['bonus_level', 'card', 'check_id'], 'string', 'max' => 35], [['password', 'keycode', 'seller_id'], 'string', 'max' => 36], [['email_true', 'phone_true'], 'string', 'max' => 15], [['check_id_forgot', 'sid_forgot'], 'string', 'max' => 45], @@ -286,6 +287,7 @@ class Users extends \yii\db\ActiveRecord 'black_list' => 'Black List', 'events' => 'Events', 'telegram_unsubscribed_at' => 'Telegram Unsubscribed At', + 'bonus_level' => 'Bonus Level' ]; }