Files
alrahma_sunday_school/app/Database/Migrations/2026-01-14-000200_CreateClassProgressReports.php
2026-05-16 13:44:12 -04:00

47 lines
1.9 KiB
PHP
Executable File

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateClassProgressReports extends Migration
{
public function up()
{
if ($this->db->tableExists('class_progress_reports')) {
return;
}
$this->forge->addField([
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
'class_section_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
'teacher_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
'week_start' => ['type' => 'DATE'],
'week_end' => ['type' => 'DATE'],
'subject' => ['type' => 'VARCHAR', 'constraint' => 160, 'null' => true],
'unit_title' => ['type' => 'VARCHAR', 'constraint' => 120, 'null' => true],
'covered' => ['type' => 'TEXT'],
'homework' => ['type' => 'TEXT', 'null' => true],
'assessment' => ['type' => 'TEXT', 'null' => true],
'status' => ['type' => 'VARCHAR', 'constraint' => 20],
'status_notes' => ['type' => 'VARCHAR', 'constraint' => 200, 'null' => true],
'class_notes' => ['type' => 'TEXT', 'null' => true],
'next_week_plan' => ['type' => 'TEXT'],
'support_needed' => ['type' => 'TEXT', 'null' => true],
'flags_json' => ['type' => 'TEXT', 'null' => true],
'attachment_path' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'created_at' => ['type' => 'DATETIME', 'null' => true],
'updated_at' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addKey('id', true);
$this->forge->addKey(['class_section_id', 'week_start', 'week_end']);
$this->forge->createTable('class_progress_reports');
}
public function down()
{
$this->forge->dropTable('class_progress_reports', true);
}
}