2025-09-15 15:45:44 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
|
|
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
|
|
2025-09-16 10:10:19 +07:00
|
|
|
class CreateValueSetTable extends Migration {
|
2025-09-15 15:45:44 +07:00
|
|
|
public function up() {
|
|
|
|
|
|
|
|
|
|
$this->forge->addField([
|
|
|
|
|
'VID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
|
|
|
|
'SiteID' => ['type' => 'INT', 'null' => true],
|
2025-09-17 15:50:55 +07:00
|
|
|
'VSetID' => ['type' => 'INT', 'null' => true],
|
2025-09-15 15:45:44 +07:00
|
|
|
'VOrder' => ['type' => 'INT', 'null' => true],
|
2025-09-16 10:10:19 +07:00
|
|
|
'VValue' => ['type' => 'varchar', 'constraint' => 10],
|
2025-09-15 15:45:44 +07:00
|
|
|
'VDesc' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
|
|
|
|
'VCategory' => ['type' => 'int', 'null' => true],
|
|
|
|
|
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
|
|
|
|
]);
|
2025-09-16 15:33:22 +07:00
|
|
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
2025-09-15 15:45:44 +07:00
|
|
|
$this->forge->addKey('VID', true);
|
|
|
|
|
$this->forge->createTable('valueset');
|
|
|
|
|
|
|
|
|
|
$this->forge->addField([
|
2025-09-17 15:50:55 +07:00
|
|
|
'VSetID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
2025-09-15 15:45:44 +07:00
|
|
|
'SiteID' => ['type' => 'INT', 'null' => true],
|
|
|
|
|
'VSName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => false],
|
|
|
|
|
'VSDesc' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => false],
|
|
|
|
|
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
|
|
|
|
]);
|
2025-09-16 15:33:22 +07:00
|
|
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
2025-09-17 15:50:55 +07:00
|
|
|
$this->forge->addKey('VSetID', true);
|
|
|
|
|
$this->forge->createTable('valuesetdef');
|
2025-09-15 15:45:44 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function down() {
|
|
|
|
|
$this->forge->dropTable('valueset');
|
2025-09-17 15:50:55 +07:00
|
|
|
$this->forge->dropTable('valuesetdef');
|
2025-09-15 15:45:44 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|