Files
API-KTA/app/Database/Migrations/2023-10-19-185755_SuperGroup.php
2026-04-25 04:41:23 +07:00

56 lines
1.8 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class SuperGroup extends Migration
{
public function up()
{
$db = \Config\Database::connect();
if ($db->getPrefix() && ($db->getPlatform() == 'Postgre')) {
$pr = $db->getPrefix();
$ff = explode('.', $pr);
$db = new \Config\Database;
$dbSelect = $db->default;
$dbSelect['DBPrefix'] = '';
$dbSelect['schema'] = 'Postgre';
$forge = \Config\Database::forge($dbSelect);
$forge->addField([
'super_group_id' => [
'type' => 'INT',
'constraint' => 255,
'auto_increment' => true,
],
'super_group_unique' => [
'type' => 'INT',
'constraint' => 255,
'auto_increment' => true,
'unique' => true,
],
'domain_id' => [
'type' => 'INT',
'constraint' => 255,
],
'group_name' => [
'type' => 'VARCHAR',
'constraint' => 200,
'null' => true,
],
'status' => [
'type' => 'INT',
'constraint' => 1,
'null' => true,
],
'created_at timestamp without time zone NULL DEFAULT CURRENT_TIMESTAMP',
]);
$forge->createTable('super_group');
}
}
public function down()
{
$this->forge->dropTable('super_group');
}
}