35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?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);
|
|
}
|
|
}
|