46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
/**
|
|
* Миграция для таблицы сессий CodeIgniter 4
|
|
*
|
|
* Эта таблица используется для хранения сессий в базе данных,
|
|
* что позволяет управлять активными сессиями пользователей.
|
|
*/
|
|
class CreateCiSessionsTable extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 128,
|
|
],
|
|
'ip_address' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 45,
|
|
],
|
|
'timestamp' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'default' => 0,
|
|
],
|
|
'data' => [
|
|
'type' => 'BLOB',
|
|
'null' => true,
|
|
],
|
|
]);
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addKey('timestamp');
|
|
$this->forge->createTable('ci_sessions');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('ci_sessions');
|
|
}
|
|
}
|