Files
alrahma_sunday_school/app/Database/Migrations/2026-01-30-000100_CreateParentMeetingSchedules.php
2026-02-10 22:11:06 -05:00

105 lines
2.9 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateParentMeetingSchedules extends Migration
{
public function up()
{
if ($this->db->tableExists('parent_meeting_schedules')) {
return;
}
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'student_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'parent_user_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => true,
],
'parent_name' => [
'type' => 'VARCHAR',
'constraint' => 200,
'null' => true,
],
'student_name' => [
'type' => 'VARCHAR',
'constraint' => 200,
'null' => true,
],
'class_section_name' => [
'type' => 'VARCHAR',
'constraint' => 200,
'null' => true,
],
'date' => [
'type' => 'DATE',
],
'time' => [
'type' => 'TIME',
'null' => true,
],
'notes' => [
'type' => 'TEXT',
'null' => true,
],
'semester' => [
'type' => 'VARCHAR',
'constraint' => 20,
'null' => true,
],
'school_year' => [
'type' => 'VARCHAR',
'constraint' => 20,
'null' => true,
],
'status' => [
'type' => 'VARCHAR',
'constraint' => 20,
'default' => 'scheduled',
],
'created_by' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => true,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('id', true);
$this->forge->addKey('student_id');
$this->forge->addKey('parent_user_id');
$this->forge->addKey('date');
$this->forge->createTable('parent_meeting_schedules', true);
}
public function down()
{
if ($this->db->tableExists('parent_meeting_schedules')) {
$this->forge->dropTable('parent_meeting_schedules', true);
}
}
}