35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreatePlacementBatches extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
if ($this->db->tableExists('placement_batches')) {
|
|
return;
|
|
}
|
|
|
|
$this->forge->addField([
|
|
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
|
'placement_test' => ['type' => 'VARCHAR', 'constraint' => 30],
|
|
'school_year' => ['type' => 'VARCHAR', 'constraint' => 20],
|
|
'created_by' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
|
|
'updated_by' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
|
|
'created_at' => ['type' => 'DATETIME', 'null' => true],
|
|
'updated_at' => ['type' => 'DATETIME', 'null' => true],
|
|
]);
|
|
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addKey(['placement_test', 'school_year']);
|
|
$this->forge->createTable('placement_batches');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('placement_batches', true);
|
|
}
|
|
}
|