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

37 lines
1.7 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateCompetitionClassWinners extends Migration
{
public function up()
{
$this->forge->addField([
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
'competition_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
'class_section_id' => ['type' => 'INT', 'constraint' => 11],
'winners_override' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'question_count' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
'prize_1' => ['type' => 'DECIMAL', 'constraint' => '10,2', 'null' => true],
'prize_2' => ['type' => 'DECIMAL', 'constraint' => '10,2', 'null' => true],
'prize_3' => ['type' => 'DECIMAL', 'constraint' => '10,2', 'null' => true],
'prize_4' => ['type' => 'DECIMAL', 'constraint' => '10,2', 'null' => true],
'prize_5' => ['type' => 'DECIMAL', 'constraint' => '10,2', 'null' => true],
'prize_6' => ['type' => 'DECIMAL', 'constraint' => '10,2', 'null' => true],
'created_at' => ['type' => 'DATETIME', 'null' => true],
'updated_at' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addKey('id', true);
$this->forge->addUniqueKey(['competition_id', 'class_section_id']);
$this->forge->createTable('competition_class_winners', true);
}
public function down()
{
$this->forge->dropTable('competition_class_winners', true);
}
}