summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2018-02-03 16:54:09 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2018-02-03 16:54:09 +0100
commitab94447fc34aeddceabcd82050224b03661938d8 (patch)
tree1c46d3ad6e865fcbe4fd1282df6b90c66f980450
parent8f97ddf3dd6c367f4b635a87345c3a1b7a26a093 (diff)
downloadmigrations-ab94447fc34aeddceabcd82050224b03661938d8.tar.gz
migrations-ab94447fc34aeddceabcd82050224b03661938d8.zip
import from vainsocial
-rw-r--r--migrations/2017_12_28_000000_simplify_phases.php177
-rw-r--r--migrations/2017_12_30_000000_add_index_on_dimensions.php55
-rw-r--r--migrations/2017_12_31_000000_add_player_last_crunch_id.php33
-rw-r--r--migrations/2018_01_03_000000_add_weekly_series_seed.php58
4 files changed, 323 insertions, 0 deletions
diff --git a/migrations/2017_12_28_000000_simplify_phases.php b/migrations/2017_12_28_000000_simplify_phases.php
new file mode 100644
index 0000000..c1ea50e
--- /dev/null
+++ b/migrations/2017_12_28_000000_simplify_phases.php
@@ -0,0 +1,177 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class SimplifyPhases extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::drop('participant_phases');
+ Schema::create('participant_phases', function (Blueprint $table) {
+ $table->increments('id');
+ $table->timestamps();
+ $table->unsignedSmallInteger('start');
+ $table->unsignedSmallInteger('end');
+
+ // foreign key: api id
+ $table->uuid('participant_api_id')->index();
+ $table->uuid('match_api_id')->index();
+
+ // snapshot stats
+ $table->double('dmg_true')->nullable();
+ $table->double('dmg_dealt')->nullable();
+ $table->double('dmg_rcvd_dealt')->nullable();
+ $table->double('dmg_rcvd_true')->nullable();
+
+ // other stats
+ $table->integer('draft_position')->nullable();
+ $table->integer('ban')->nullable();
+ $table->integer('pick')->nullable();
+
+ // healing stats
+ $table->double('heal_heal')->nullable();
+ $table->double('heal_healed')->nullable();
+ $table->double('heal_rcvd_heal')->nullable();
+ $table->double('heal_rcvd_healed')->nullable();
+ $table->double('heal_rcvd_vamp')->nullable();
+
+ $table->unique(['participant_api_id', 'start', 'end']);
+ });
+ }
+
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::drop('participant_phases');
+ Schema::create('participant_phases', function (Blueprint $table) {
+ $table->increments('id');
+ $table->timestamps();
+ $table->unsignedSmallInteger('start');
+ $table->unsignedSmallInteger('end');
+
+ // foreign key: api id
+ $table->uuid('participant_api_id')->index();
+ $table->uuid('match_api_id')->index();
+
+ // snapshot stats
+ $table->unsignedSmallInteger('kills')->nullable();
+ $table->unsignedSmallInteger('deaths')->nullable();
+ $table->unsignedSmallInteger('assists')->nullable();
+ $table->unsignedMediumInteger('farm')->nullable();
+ $table->unsignedSmallInteger('minion_kills')->nullable();
+ $table->unsignedSmallInteger('jungle_kills')->nullable();
+ $table->unsignedSmallInteger('non_jungle_minion_kills')->nullable();
+ $table->unsignedSmallInteger('crystal_mine_captures')->nullable();
+ $table->unsignedSmallInteger('gold_mine_captures')->nullable();
+ $table->unsignedSmallInteger('kraken_captures')->nullable();
+ $table->unsignedSmallInteger('turret_captures')->nullable();
+ $table->unsignedMediumInteger('gold')->nullable();
+ $table->double('dmg_true_hero')->nullable();
+ $table->double('dmg_true_kraken')->nullable();
+ $table->double('dmg_true_turret')->nullable();
+ $table->double('dmg_true_vain_turret')->nullable();
+ $table->double('dmg_true_others')->nullable();
+ $table->double('dmg_dealt_hero')->nullable();
+ $table->double('dmg_dealt_kraken')->nullable();
+ $table->double('dmg_dealt_turret')->nullable();
+ $table->double('dmg_dealt_vain_turret')->nullable();
+ $table->double('dmg_dealt_others')->nullable();
+
+ $table->double('dmg_rcvd_dealt_hero')->nullable();
+ $table->double('dmg_rcvd_true_hero')->nullable();
+ $table->double('dmg_rcvd_dealt_others')->nullable();
+ $table->double('dmg_rcvd_true_others')->nullable();
+
+ $table->unsignedTinyInteger('ability_a_level')->nullable();
+ $table->unsignedTinyInteger('ability_b_level')->nullable();
+ $table->unsignedTinyInteger('ability_c_level')->nullable();
+
+ $table->unsignedTinyInteger('hero_level')->nullable(); // only via Telemetry!
+
+ // traits
+ $table->double('kda_ratio', 5, 5)->nullable();
+ $table->double('kill_participation', 5, 5)->nullable();
+ $table->double('cs_per_min', 7, 5)->nullable();
+ $table->double('kills_per_min', 6, 5)->nullable();
+ // scores - all int between 0 and 100
+ // shared
+ $table->double('impact_score')->nullable();
+ $table->double('objective_score')->nullable();
+ $table->double('damage_cp_score')->nullable(); // c & j
+ $table->double('damage_wp_score')->nullable(); // c & j
+ $table->double('sustain_score')->nullable(); // j & cpt
+ // carry
+ $table->double('farm_lane_score')->nullable();
+ $table->double('kill_score')->nullable();
+ $table->double('objective_lane_score')->nullable();
+ // jungler
+ $table->double('farm_jungle_score')->nullable();
+ $table->double('peel_score')->nullable();
+ $table->double('kill_assist_score')->nullable();
+ $table->double('objective_jungle_score')->nullable(); // gold mine, sentry, Kraken
+ // captain
+ $table->double('vision_score')->nullable();
+ $table->double('heal_score')->nullable();
+ $table->double('assist_score')->nullable();
+ $table->double('utility_score')->nullable();
+ // meta
+ $table->double('synergy_score')->nullable();
+ $table->double('build_score')->nullable();
+ $table->double('offmeta_score')->nullable();
+
+ $table->unique(['participant_api_id', 'start', 'end']);
+
+ $table->integer('draft_position')->nullable();
+ $table->integer('ban')->nullable();
+ $table->integer('pick')->nullable();
+
+ $table->double("heal_heal_hero")->nullable();
+ $table->double("heal_healed_hero")->nullable();
+ $table->double("heal_heal_ally")->nullable();
+ $table->double("heal_healed_ally")->nullable();
+ $table->double("heal_heal_other")->nullable();
+ $table->double("heal_healed_other")->nullable();
+ $table->double("heal_rcvd_heal_hero")->nullable();
+ $table->double("heal_rcvd_healed_hero")->nullable();
+ $table->double("heal_rcvd_heal_other")->nullable();
+ $table->double("heal_rcvd_healed_other")->nullable();
+ $table->double("heal_rcvd_heal_ally")->nullable();
+ $table->double("heal_rcvd_healed_ally")->nullable();
+ $table->double("heal_rcvd_healed_vamp")->nullable();
+
+ $table->binary('items');
+ $table->binary('item_grants');
+ $table->binary('item_grants_inorder');
+ $table->binary('item_sells');
+ $table->unsignedSmallInteger('ability_a_use');
+ $table->unsignedSmallInteger('ability_b_use');
+ $table->unsignedSmallInteger('ability_c_use');
+ $table->unsignedInteger('ability_a_damage_true');
+ $table->unsignedInteger('ability_a_damage_dealt');
+ $table->unsignedInteger('ability_b_damage_true');
+ $table->unsignedInteger('ability_b_damage_dealt');
+ $table->unsignedInteger('ability_c_damage_true');
+ $table->unsignedInteger('ability_c_damage_dealt');
+ $table->unsignedInteger('ability_perk_damage_true');
+ $table->unsignedInteger('ability_perk_damage_dealt');
+ $table->unsignedInteger('ability_aa_damage_true');
+ $table->unsignedInteger('ability_aa_damage_dealt');
+ $table->unsignedInteger('ability_aacrit_damage_true');
+ $table->unsignedInteger('ability_aacrit_damage_dealt');
+ $table->binary('item_uses');
+ $table->binary('player_damage');
+ });
+ }
+}
diff --git a/migrations/2017_12_30_000000_add_index_on_dimensions.php b/migrations/2017_12_30_000000_add_index_on_dimensions.php
new file mode 100644
index 0000000..05e8e16
--- /dev/null
+++ b/migrations/2017_12_30_000000_add_index_on_dimensions.php
@@ -0,0 +1,55 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddIndexOnDimensions extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('filter', function (Blueprint $table) {
+ $table->unique(['dimension_on', 'name']);
+ });
+ Schema::table('series', function (Blueprint $table) {
+ $table->index(['name', 'dimension_on', 'show_in_web', 'start', 'end']);
+ });
+ Schema::table('hero', function (Blueprint $table) {
+ $table->unique('name');
+ });
+ Schema::table('role', function (Blueprint $table) {
+ $table->unique('name');
+ });
+ Schema::table('region', function (Blueprint $table) {
+ $table->unique('name');
+ });
+ Schema::table('skill_tier', function (Blueprint $table) {
+ $table->unique(['name', 'start', 'end']);
+ });
+ Schema::table('build', function (Blueprint $table) {
+ $table->index([
+ 'dimension_on', 'name',
+ 'item_1', 'item_1_count',
+ 'item_2', 'item_2_count',
+ 'item_3', 'item_3_count',
+ 'item_4', 'item_4_count',
+ 'item_5', 'item_5_count',
+ 'item_6', 'item_6_count'
+ ], 'dim_name_items_counts');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ }
+}
diff --git a/migrations/2017_12_31_000000_add_player_last_crunch_id.php b/migrations/2017_12_31_000000_add_player_last_crunch_id.php
new file mode 100644
index 0000000..4863fd8
--- /dev/null
+++ b/migrations/2017_12_31_000000_add_player_last_crunch_id.php
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddPlayerLastCrunchId extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('player', function (Blueprint $table) {
+ $table->unsignedBigInteger("last_crunch_id")->after("last_match_created_date")->nullable();
+ });
+ }
+
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('player', function (Blueprint $table) {
+ $table->dropColumn("last_crunch_id");
+ });
+ }
+}
diff --git a/migrations/2018_01_03_000000_add_weekly_series_seed.php b/migrations/2018_01_03_000000_add_weekly_series_seed.php
new file mode 100644
index 0000000..7852ba9
--- /dev/null
+++ b/migrations/2018_01_03_000000_add_weekly_series_seed.php
@@ -0,0 +1,58 @@
+<?php
+
+use Carbon\Carbon;
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddWeeklySeriesSeed extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ $now = Carbon::create(2018, 1, 3, 0, 0, 0);
+ $nextweek = $now->copy()->addWeek()->subMinute();
+
+ for($i = 0; $i <= 52; $i++) {
+ $point_name = $now->year . '-' . $now->month . '-' . $now->day;
+ DB::table('series')->insert([
+ 'name' => $point_name,
+ 'dimension_on' => 'global',
+ 'start'=> $now,
+ 'end'=> $nextweek,
+ 'show_in_web' => false
+ ]);
+
+ $now = $now->addWeek();
+ $nextweek = $nextweek->addWeek();
+ }
+ }
+
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ $now = Carbon::createFromDate(2018, 1, 3, 0, 0, 0);
+ $nextweek = $now->copy()->addWeek();
+
+ for($i = 0; $i <= 52; $i++) {
+ $point_name = $now->year . '-' . $now->month . '-' . $now->day;
+ $sql = 'delete from series where name = "' . $point_name . '"';
+ DB::connection()->getPdo()->exec($sql);
+
+ $now = $now->addWeek();
+ $nextweek = $nextweek->addWeek();
+ }
+ }
+}
+
+