Created
September 1, 2020 06:49
-
-
Save DeaVenditama/3a0e5e49edd2a9021f24e415d8d1ec74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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