25 lines
813 B
PHP
25 lines
813 B
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateZonesTable extends Migration {
|
|
public function up() {
|
|
|
|
$this->forge->addField([
|
|
'zoneid' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
|
'parentzoneid' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
|
|
'zonecode' => ['type' => 'VARCHAR', 'constraint' => 10, 'null' => false],
|
|
'zoneclass' => ['type' => 'VARCHAR', 'constraint' => 5, 'null' => false],
|
|
'zonename' => ['type' => 'VARCHAR', 'constraint' => 100, 'null' => false],
|
|
]);
|
|
|
|
$this->forge->addKey('zoneid', true);
|
|
$this->forge->createTable('zones');
|
|
}
|
|
|
|
public function down() {
|
|
$this->forge->dropTable('zones');
|
|
}
|
|
} |