Files
presensi/app/Database/Migrations/2026-02-20-110923_CreateTelegramAccountsTable.php
2026-03-05 14:37:36 +07:00

63 lines
1.7 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateTelegramAccountsTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'telegram_user_id' => [
'type' => 'BIGINT',
'constraint' => 20,
'unsigned' => true,
'unique' => true,
],
'username' => [
'type' => 'VARCHAR',
'constraint' => '255',
'null' => true,
],
'first_name' => [
'type' => 'VARCHAR',
'constraint' => '255',
'null' => true,
],
'last_name' => [
'type' => 'VARCHAR',
'constraint' => '255',
'null' => true,
],
'is_verified' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('id', true);
$this->forge->createTable('telegram_accounts');
}
public function down()
{
$this->forge->dropTable('telegram_accounts');
}
}