%PDF- %PDF-
Direktori : /www/loslex/test/database/migrations/ |
Current File : //www/loslex/test/database/migrations/2024_03_25_202125_penalties.php |
<?php use App\Models\ContestCategory; use App\Models\ContestLevel; use Database\Seeders\MaterialisedViewsSeeder; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; class Penalties extends Migration { public function up(): void { Schema::create('penalties', function (Blueprint $table) { $table->id(); $table->foreignIdFor(ContestCategory::class, "category_id"); $table->foreignIdFor(ContestLevel::class, "level_id"); $table->decimal("charlie", 5, 2, true); $table->decimal("delta", 5, 2, true); $table->decimal("miss", 5, 2, true); $table->decimal("misspopper", 5, 2, true); $table->decimal("noshoot", 5, 2, true); $table->decimal("proc", 5, 2, true); }); DB::statement("CREATE OR REPLACE VIEW `w_shooter_stage_results` AS " . file_get_contents('./database/migrations/views/2024_03_25_204000_shooter_stage_results.sql')); // Handgun DB::table('penalties')->insert(['category_id' => 1, 'level_id' => 1, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 1, 'level_id' => 2, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 1, 'level_id' => 3, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 1, 'level_id' => 4, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 1, 'level_id' => 5, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 1, 'level_id' => 7, 'charlie' => 0.0, 'delta' => 0.0, 'miss' => 5.0, 'misspopper' => 5.0, 'noshoot' => 0.0, 'proc' => 5.0]); // Rifle DB::table('penalties')->insert(['category_id' => 2, 'level_id' => 1, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 2, 'level_id' => 2, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 2, 'level_id' => 3, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 2, 'level_id' => 4, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 2, 'level_id' => 5, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 2, 'level_id' => 7, 'charlie' => 0.0, 'delta' => 0.0, 'miss' => 5.0, 'misspopper' => 5.0, 'noshoot' => 0.0, 'proc' => 5.0]);; // Shotgun DB::table('penalties')->insert(['category_id' => 3, 'level_id' => 1, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 3, 'level_id' => 2, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 3, 'level_id' => 3, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 3, 'level_id' => 4, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 3, 'level_id' => 5, 'charlie' => 1.0, 'delta' => 2.0, 'miss' => 5.0, 'misspopper' => 10.0, 'noshoot' => 10.0, 'proc' => 3.0]); DB::table('penalties')->insert(['category_id' => 3, 'level_id' => 7, 'charlie' => 0.0, 'delta' => 0.0, 'miss' => 5.0, 'misspopper' => 5.0, 'noshoot' => 0.0, 'proc' => 5.0]); // Renew materialized views with new results data (new MaterialisedViewsSeeder())->run(); } public function down(): void { } }