110 lines
3.1 KiB
PHP
110 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateExamDraftSubmissions extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'teacher_id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'null' => false,
|
|
],
|
|
'class_section_id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'null' => false,
|
|
],
|
|
'semester' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 32,
|
|
'null' => false,
|
|
],
|
|
'school_year' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 32,
|
|
'null' => false,
|
|
],
|
|
'exam_type' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 64,
|
|
'null' => true,
|
|
],
|
|
'draft_title' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 191,
|
|
'null' => false,
|
|
],
|
|
'description' => [
|
|
'type' => 'TEXT',
|
|
'null' => true,
|
|
],
|
|
'teacher_file' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 512,
|
|
'null' => true,
|
|
],
|
|
'teacher_filename' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 512,
|
|
'null' => true,
|
|
],
|
|
'status' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 32,
|
|
'default' => 'pending',
|
|
],
|
|
'admin_id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'null' => true,
|
|
],
|
|
'admin_comments' => [
|
|
'type' => 'TEXT',
|
|
'null' => true,
|
|
],
|
|
'reviewed_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'final_file' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 512,
|
|
'null' => true,
|
|
],
|
|
'final_filename' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 512,
|
|
'null' => true,
|
|
],
|
|
'created_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => false,
|
|
'default' => 'CURRENT_TIMESTAMP',
|
|
],
|
|
'updated_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
]);
|
|
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addKey(['teacher_id', 'class_section_id']);
|
|
$this->forge->createTable('exam_drafts');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('exam_drafts');
|
|
}
|
|
}
|