--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%users_telegram_message}}`.
+ */
+class m250110_074741_create_users_telegram_message_table extends Migration
+{
+ const TABLE_NAME = 'erp24.users_telegram_message';
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+ if (!isset($tableSchema)) {
+ $this->createTable(self::TABLE_NAME, [
+ 'id' => $this->bigPrimaryKey()->comment('ID'),
+ 'chat_id' => $this->string()->notNull()->comment('Chat ID'),
+ 'phone' => $this->string()->notNull()->comment('Телефон'),
+ 'message' => $this->string()->notNull()->comment('Текст сообщения в Телеграм'),
+ 'kogort_date' => $this->date()->notNull()->comment('Дата когорты'),
+ 'target_date' => $this->date()->notNull()->comment('Целевая дата'),
+ 'type' => $this->integer()->notNull()->defaultValue(1)
+ ->comment('Номер рассылки: 1- первая, 2 - вторая'),
+ 'created_at' => $this->dateTime()->notNull()->defaultExpression('CURRENT_TIMESTAMP')
+ ->comment('Дата создания записи'),
+ ]);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+ if (isset($tableSchema)) {
+ $this->dropTable(self::TABLE_NAME);
+ }
+ }
+}
];
public const STATUSES = [
- 'created' => 1,
- 'first' => 2,
- 'second' => 3,
+ 'created' => 1, // создана запись в когорте
+ 'first' => 2, // отправлено первое сообщение в чатбот на номер в когорте
+ 'second' => 3, // отправлено второе сообщение на номер в когорте
];
/**
* {@inheritdoc}