Files
alrahma_sunday_school/app/Database/Migrations/2026-01-20-000000_CreateSubjectCurriculumItems.php
T
2026-02-10 22:11:06 -05:00

65 lines
1.7 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateSubjectCurriculumItems extends Migration
{
public function up()
{
if ($this->db->tableExists('subject_curriculum_items')) {
return;
}
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'class_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'subject' => [
'type' => 'ENUM',
'constraint' => ['islamic', 'quran'],
'default' => 'islamic',
],
'unit_number' => [
'type' => 'SMALLINT',
'null' => true,
],
'unit_title' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => true,
],
'chapter_name' => [
'type' => 'VARCHAR',
'constraint' => 255,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('id', true);
$this->forge->addKey(['class_id', 'subject']);
$this->forge->createTable('subject_curriculum_items');
}
public function down()
{
$this->forge->dropTable('subject_curriculum_items', true);
}
}