40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class AddEmailVerificationToUsers extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
// Добавляем поля для верификации email
|
|
$fields = [
|
|
'verification_token' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 255,
|
|
'null' => true,
|
|
'comment' => 'Токен для подтверждения email',
|
|
],
|
|
'email_verified' => [
|
|
'type' => 'TINYINT',
|
|
'constraint' => 1,
|
|
'default' => 0,
|
|
'comment' => 'Статус подтверждения email (0 - не подтвержден, 1 - подтвержден)',
|
|
],
|
|
'verified_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
'comment' => 'Дата и время подтверждения email',
|
|
],
|
|
];
|
|
|
|
$this->forge->addColumn('users', $fields);
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropColumn('users', ['verification_token', 'email_verified', 'verified_at']);
|
|
}
|
|
}
|