recreate project
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CreateCompetitionWinners 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],
|
||||
'student_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
|
||||
'class_section_id' => ['type' => 'INT', 'constraint' => 11, 'null' => true],
|
||||
'rank' => ['type' => 'INT', 'constraint' => 11],
|
||||
'score' => ['type' => 'DECIMAL', 'constraint' => '6,2', 'default' => 0],
|
||||
'prize_amount' => ['type' => 'DECIMAL', 'constraint' => '10,2', 'default' => 0],
|
||||
'created_at' => ['type' => 'DATETIME', 'null' => true],
|
||||
]);
|
||||
|
||||
$this->forge->addKey('id', true);
|
||||
$this->forge->addKey(['competition_id']);
|
||||
$this->forge->addKey(['class_section_id']);
|
||||
$this->forge->addUniqueKey(['competition_id', 'class_section_id', 'rank']);
|
||||
$this->forge->addUniqueKey(['competition_id', 'class_section_id', 'student_id']);
|
||||
$this->forge->createTable('competition_winners', true);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable('competition_winners', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user