feat: start migrations

This commit is contained in:
Kalane 2021-09-12 15:16:08 +02:00
parent c61f5615d7
commit d82285050f
8 changed files with 190 additions and 8 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,27 @@
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class Matches extends BaseSchema {
protected tableName = 'matches'
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.string('id', 15).primary()
table.integer('gameId').notNullable()
table.integer('map').notNullable()
table.integer('gamemode').notNullable()
table.integer('date').notNullable()
table.string('region', 4).notNullable()
table.integer('result').notNullable()
table.integer('season').notNullable()
table.integer('game_duration').notNullable()
table.integer('blue_team_id').notNullable()
table.integer('red_team_id').notNullable()
})
}
public async down() {
this.schema.dropTable(this.tableName)
}
}

View file

@ -0,0 +1,70 @@
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class MatchPlayers extends BaseSchema {
protected tableName = 'match_players'
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id')
table.string('match_id', 15).notNullable()
table.integer('participant_id').notNullable()
table.integer('summoner_id').notNullable()
table.string('summoner_puuid', 78).notNullable()
table.string('summoner_name', 16).notNullable()
table.integer('team').notNullable()
table.string('team_position', 8).notNullable()
table.integer('kills').notNullable()
table.integer('deaths').notNullable()
table.integer('assists').notNullable()
table.integer('kda').notNullable()
table.integer('champ_level').notNullable()
table.integer('champion_id').notNullable()
table.integer('champion_role1').notNullable()
table.integer('champion_role2').nullable()
table.integer('double_kills').notNullable()
table.integer('triple_kills').notNullable()
table.integer('quadra_kills').notNullable()
table.integer('penta_kills').notNullable()
table.integer('baron_kills').notNullable()
table.integer('dragon_kills').notNullable()
table.integer('turret_kills').notNullable()
table.integer('vision_score').notNullable()
table.integer('gold').notNullable()
table.integer('summoner1_id').notNullable()
table.integer('summoner2_id').notNullable()
table.integer('item0').notNullable()
table.integer('item1').notNullable()
table.integer('item2').notNullable()
table.integer('item3').notNullable()
table.integer('item4').notNullable()
table.integer('item5').notNullable()
table.integer('item6').notNullable()
table.integer('damage_dealt_objectives').notNullable()
table.integer('damage_dealt_to_champions').notNullable()
table.integer('damage_taken').notNullable()
table.integer('heal').notNullable()
table.integer('minions').notNullable()
table.integer('critical_strike').notNullable()
table.integer('killing_spree').notNullable()
table.integer('time_spent_living').notNullable()
table.integer('perks_primary_style').notNullable()
table.integer('perks_secondary_style').notNullable()
table.specificType('perks_selected', 'INT[]').notNullable()
})
}
public async down() {
this.schema.dropTable(this.tableName)
}
}

View file

@ -0,0 +1,21 @@
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class Summoners extends BaseSchema {
protected tableName = 'summoners'
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.string('puuid', 78).primary()
/**
* Uses timestamptz for PostgreSQL and DATETIME2 for MSSQL
*/
table.timestamp('created_at', { useTz: true })
table.timestamp('updated_at', { useTz: true })
})
}
public async down() {
this.schema.dropTable(this.tableName)
}
}

View file

@ -0,0 +1,22 @@
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class SummonerNames extends BaseSchema {
protected tableName = 'summoner_names'
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id')
table.string('summoner_puuid', 78).notNullable()
table.string('name', 16).notNullable()
/**
* Uses timestamptz for PostgreSQL and DATETIME2 for MSSQL
*/
table.timestamp('created_at', { useTz: true })
})
}
public async down() {
this.schema.dropTable(this.tableName)
}
}

View file

@ -0,0 +1,17 @@
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class SummonerMatchLists extends BaseSchema {
protected tableName = 'summoner_matchlist'
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id')
table.string('summoner_puuid', 78).notNullable()
table.string('match_id', 15).notNullable()
})
}
public async down() {
this.schema.dropTable(this.tableName)
}
}

View file

@ -0,0 +1,25 @@
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class MatchTeams extends BaseSchema {
protected tableName = 'match_teams'
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id')
table.integer('barons').notNullable()
table.string('color', 4).notNullable()
table.integer('dragons').notNullable()
table.integer('inhibitors').notNullable()
table.integer('result').notNullable()
table.integer('rift_heralds').notNullable()
table.specificType('bans', 'INT[]').notNullable()
table.specificType('ban_orders', 'INT[]').notNullable()
})
}
public async down() {
this.schema.dropTable(this.tableName)
}
}

View file

@ -298,7 +298,7 @@ export interface ParticipantDto {
objectivesStolenAssists: number;
participantId: number;
pentaKills: number;
perks: PerksDto; // TODO
perks: PerksDto;
physicalDamageDealt: number;
physicalDamageDealtToChampions: number;
physicalDamageTaken: number;
@ -357,23 +357,23 @@ export enum ChampionTransformDto {
export type LaneDto = 'TOP' | 'JUNGLE' |'MIDDLE' | 'BOTTOM'
export interface PerksDto {
statPerks: StatPerksDto;
styles: StyleDto[];
statPerks: PerkStatsDto;
styles: PerkStyleDto[];
}
export interface StatPerksDto {
export interface PerkStatsDto {
defense: number;
flex: number;
offense: number;
}
export interface StyleDto {
export interface PerkStyleDto {
description: 'primaryStyle' | 'subStyle';
selections: SelectionDto[];
selections: PerkStyleSelectionDto[];
style: number;
}
export interface SelectionDto {
export interface PerkStyleSelectionDto {
perk: number;
var1: number;
var2: number;