Files
alrahma_sunday_school/app/Database/Migrations/2026-02-04-000300_CreateClassProgressAttachments.php
2026-05-16 13:44:12 -04:00

35 lines
1.2 KiB
PHP
Executable File

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateClassProgressAttachments extends Migration
{
public function up()
{
if ($this->db->tableExists('class_progress_attachments')) {
return;
}
$this->forge->addField([
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
'report_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
'file_path' => ['type' => 'VARCHAR', 'constraint' => 255],
'original_name' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
'mime_type' => ['type' => 'VARCHAR', 'constraint' => 120, 'null' => true],
'file_size' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
'created_at' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addKey('id', true);
$this->forge->addKey('report_id');
$this->forge->createTable('class_progress_attachments');
}
public function down()
{
$this->forge->dropTable('class_progress_attachments', true);
}
}