Skip to content

Instantly share code, notes, and snippets.

@DeaVenditama
Created September 1, 2020 06:49
Show Gist options
  • Save DeaVenditama/3a0e5e49edd2a9021f24e415d8d1ec74 to your computer and use it in GitHub Desktop.
Save DeaVenditama/3a0e5e49edd2a9021f24e415d8d1ec74 to your computer and use it in GitHub Desktop.
<?php namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class Data extends Migration
{
public function up()
{
$this->forge->addField([
'id' =>[
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'id_master_data' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'kode_wilayah'=>[
'type' => 'VARCHAR',
'constraint' => 7
],
'nilai' => [
'type' => 'INT',
'constraint' => 11,
'null' => true,
]
]);
$this->forge->addKey('id', true);
$this->forge->addForeignKey('id_master_data','master_data','id');
$this->forge->createTable('data');
}
//--------------------------------------------------------------------
public function down()
{
$this->forge->dropTable('data');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment