add CRM module start
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AddTokenExpiresToUsers extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
// Проверяем, существует ли уже поле token_expires_at
|
||||
$fields = $this->db->getFieldData('users');
|
||||
$existingFields = array_column($fields, 'name');
|
||||
|
||||
if (!in_array('token_expires_at', $existingFields)) {
|
||||
$this->db->simpleQuery("ALTER TABLE users ADD COLUMN token_expires_at DATETIME NULL AFTER verification_token");
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$fields = $this->db->getFieldData('users');
|
||||
$existingFields = array_column($fields, 'name');
|
||||
|
||||
if (in_array('token_expires_at', $existingFields)) {
|
||||
$this->db->simpleQuery("ALTER TABLE users DROP COLUMN token_expires_at");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user