init
This commit is contained in:
55
app/Database/Migrations/2023-10-19-185755_SuperGroup.php
Normal file
55
app/Database/Migrations/2023-10-19-185755_SuperGroup.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user