83 lines
2.4 KiB
PHP
83 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateEarlyDismissalSignatures extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
if ($this->db->tableExists('early_dismissal_signatures')) {
|
|
return;
|
|
}
|
|
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'report_date' => [
|
|
'type' => 'DATE',
|
|
'null' => false,
|
|
],
|
|
'school_year' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 16,
|
|
'null' => true,
|
|
],
|
|
'semester' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 32,
|
|
'null' => true,
|
|
],
|
|
'filename' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 255,
|
|
'null' => false,
|
|
],
|
|
'original_name' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 255,
|
|
'null' => true,
|
|
],
|
|
'mime_type' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 128,
|
|
'null' => true,
|
|
],
|
|
'file_size' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'null' => true,
|
|
],
|
|
'uploaded_by' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'null' => true,
|
|
],
|
|
'created_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'updated_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
]);
|
|
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addKey(['report_date']);
|
|
$this->forge->addUniqueKey(['report_date', 'school_year', 'semester'], 'uniq_early_dismissal_signature');
|
|
$this->forge->createTable('early_dismissal_signatures', true);
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
if ($this->db->tableExists('early_dismissal_signatures')) {
|
|
$this->forge->dropTable('early_dismissal_signatures', true);
|
|
}
|
|
}
|
|
}
|