66 lines
1.9 KiB
PHP
66 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateReimbursementBatchAdminFiles extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$fields = [
|
|
'id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'batch_id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
'null' => false,
|
|
],
|
|
'admin_id' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
'null' => false,
|
|
'default' => 0,
|
|
],
|
|
'filename' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 255,
|
|
'null' => false,
|
|
],
|
|
'original_filename' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 255,
|
|
'null' => true,
|
|
],
|
|
'uploaded_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => false,
|
|
],
|
|
'uploaded_by' => [
|
|
'type' => 'INT',
|
|
'constraint' => 11,
|
|
'unsigned' => true,
|
|
'null' => true,
|
|
],
|
|
];
|
|
|
|
$this->forge->addField($fields);
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addKey('batch_id');
|
|
$this->forge->addKey('admin_id');
|
|
$this->forge->addUniqueKey(['batch_id', 'admin_id']);
|
|
$this->forge->createTable('reimbursement_batch_admin_files');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('reimbursement_batch_admin_files', true);
|
|
}
|
|
}
|