add Telegram bot tokens table and API methods

This commit is contained in:
iIronside
2023-10-24 13:34:23 +03:00
parent 3c9204f61a
commit da08bcf1b2
7 changed files with 417 additions and 1 deletions

View File

@ -0,0 +1,33 @@
<?php
use yii\db\Migration;
/**
* Class m231023_122338_create_user_tg_bot_token
*/
class m231023_122338_create_user_tg_bot_token extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%user_tg_bot_token}}', [
'id' => $this->primaryKey(),
'user_id' => $this->integer(),
'token' => $this->string()->notNull()->unique(),
'created_at' => $this->dateTime(),
'updated_at' => $this->dateTime(),
'expired_at' => $this->dateTime(),
]);
$this->addForeignKey('user_user_tg_bot_token', 'user_tg_bot_token', 'user_id', 'user', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropTable('user_tg_bot_token');
}
}