init
This commit is contained in:
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreateIperaAgreementTables extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField([
|
||||
'agreement_id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 36,
|
||||
],
|
||||
'ipera_type_id' => [
|
||||
'type' => 'INT',
|
||||
],
|
||||
'total_value' => [
|
||||
'type' => 'DECIMAL',
|
||||
'constraint' => '15,2',
|
||||
],
|
||||
'initial_fee' => [
|
||||
'type' => 'DECIMAL',
|
||||
'constraint' => '15,2',
|
||||
'default' => 0,
|
||||
],
|
||||
'tenor_years' => [
|
||||
'type' => 'INT',
|
||||
],
|
||||
'start_date' => [
|
||||
'type' => 'DATE',
|
||||
],
|
||||
'first_year_rule' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 50,
|
||||
],
|
||||
'status' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 20,
|
||||
'default' => 'Belum',
|
||||
],
|
||||
'produksi_id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 64,
|
||||
'null' => true,
|
||||
],
|
||||
'panen_id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 64,
|
||||
'null' => true,
|
||||
],
|
||||
'mitra_id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 64,
|
||||
'null' => true,
|
||||
],
|
||||
'koperasi_id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 64,
|
||||
'null' => true,
|
||||
],
|
||||
'notes' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => true,
|
||||
],
|
||||
'rounding_to' => [
|
||||
'type' => 'INT',
|
||||
'null' => true,
|
||||
],
|
||||
'is_deleted' => [
|
||||
'type' => 'BOOLEAN',
|
||||
'default' => false,
|
||||
],
|
||||
'created_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
'updated_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
'created_by' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 64,
|
||||
'null' => true,
|
||||
],
|
||||
]);
|
||||
$this->forge->addKey('agreement_id', true);
|
||||
$this->forge->addKey('koperasi_id');
|
||||
$this->forge->addKey('mitra_id');
|
||||
$this->forge->addKey('ipera_type_id');
|
||||
$this->forge->addKey('status');
|
||||
$this->forge->createTable('ipera_agreement', true);
|
||||
|
||||
$this->forge->addField([
|
||||
'schedule_id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 36,
|
||||
],
|
||||
'agreement_id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 36,
|
||||
],
|
||||
'year_index' => [
|
||||
'type' => 'INT',
|
||||
],
|
||||
'due_date' => [
|
||||
'type' => 'DATE',
|
||||
],
|
||||
'due_year' => [
|
||||
'type' => 'INT',
|
||||
],
|
||||
'amount' => [
|
||||
'type' => 'DECIMAL',
|
||||
'constraint' => '15,2',
|
||||
],
|
||||
'status' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 20,
|
||||
'default' => 'Pending',
|
||||
],
|
||||
'paid_amount' => [
|
||||
'type' => 'DECIMAL',
|
||||
'constraint' => '15,2',
|
||||
'null' => true,
|
||||
],
|
||||
'paid_at' => [
|
||||
'type' => 'DATE',
|
||||
'null' => true,
|
||||
],
|
||||
'proof_url' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 500,
|
||||
'null' => true,
|
||||
],
|
||||
'proof_id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 64,
|
||||
'null' => true,
|
||||
],
|
||||
'notes' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => true,
|
||||
],
|
||||
'created_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
'updated_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
'is_deleted' => [
|
||||
'type' => 'BOOLEAN',
|
||||
'default' => false,
|
||||
],
|
||||
]);
|
||||
$this->forge->addKey('schedule_id', true);
|
||||
$this->forge->addKey('agreement_id');
|
||||
$this->forge->addKey('status');
|
||||
$this->forge->createTable('ipera_installment_schedule', true);
|
||||
|
||||
$this->forge->addField([
|
||||
'payment_id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 36,
|
||||
],
|
||||
'schedule_id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 36,
|
||||
],
|
||||
'agreement_id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 36,
|
||||
],
|
||||
'year_index' => [
|
||||
'type' => 'INT',
|
||||
],
|
||||
'amount' => [
|
||||
'type' => 'DECIMAL',
|
||||
'constraint' => '15,2',
|
||||
],
|
||||
'payment_type' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 20,
|
||||
],
|
||||
'payment_date' => [
|
||||
'type' => 'DATE',
|
||||
],
|
||||
'proof_url' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 500,
|
||||
'null' => true,
|
||||
],
|
||||
'notes' => [
|
||||
'type' => 'TEXT',
|
||||
'null' => true,
|
||||
],
|
||||
'created_at' => [
|
||||
'type' => 'DATETIME',
|
||||
'null' => true,
|
||||
],
|
||||
'created_by' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 64,
|
||||
'null' => true,
|
||||
],
|
||||
]);
|
||||
$this->forge->addKey('payment_id', true);
|
||||
$this->forge->addKey('schedule_id');
|
||||
$this->forge->addKey('agreement_id');
|
||||
$this->forge->createTable('ipera_payment_history', true);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable('ipera_payment_history', true);
|
||||
$this->forge->dropTable('ipera_installment_schedule', true);
|
||||
$this->forge->dropTable('ipera_agreement', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user