42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateValueSetTable extends Migration {
|
|
public function up() {
|
|
|
|
$this->forge->addField([
|
|
'VID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
|
'SiteID' => ['type' => 'INT', 'null' => true],
|
|
'VSet' => ['type' => 'INT', 'null' => true],
|
|
'VOrder' => ['type' => 'INT', 'null' => true],
|
|
'VValue' => ['type' => 'varchar', 'constraint' => 10],
|
|
'VDesc' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
|
'VCategory' => ['type' => 'int', 'null' => true],
|
|
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
|
]);
|
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
|
$this->forge->addKey('VID', true);
|
|
$this->forge->createTable('valueset');
|
|
|
|
$this->forge->addField([
|
|
'VSFldID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
|
'SiteID' => ['type' => 'INT', 'null' => true],
|
|
'VSet' => ['type' => 'INT', 'null' => false],
|
|
'VSName' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => false],
|
|
'VSDesc' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => false],
|
|
'EndDate' => ['type' => 'DATETIME', 'null' => true]
|
|
]);
|
|
$this->forge->addField('CreateDate DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP');
|
|
$this->forge->addKey('VSFldID', true);
|
|
$this->forge->createTable('valuesetfld');
|
|
}
|
|
|
|
public function down() {
|
|
$this->forge->dropTable('valueset');
|
|
$this->forge->dropTable('valuesetfld');
|
|
}
|
|
|
|
} |