--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m250204_065535_add_column_bonus_level_to_users_table
+ */
+class m250204_065535_add_column_bonus_level_to_users_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('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;
+ }
+ */
+}
* @property int $events Импортированы ли события
* @property string|null $first_minus_balance
* @property string $info
+ * @property string|null $bonus_level Уровань клиента в БС
*/
class Users extends \yii\db\ActiveRecord
{
'store_id',
'first_minus_balance',
'telegram_unsubscribed_at',
-
+ 'bonus_level',
],
'safe'
],
[['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],
'black_list' => 'Black List',
'events' => 'Events',
'telegram_unsubscribed_at' => 'Telegram Unsubscribed At',
+ 'bonus_level' => 'Bonus Level'
];
}