LeagueStats/server/database/migrations/1631392817716_summoner_matchlist.ts

22 lines
585 B
TypeScript
Raw Permalink Normal View History

2021-09-12 13:16:08 +00:00
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')
2021-09-19 15:47:07 +00:00
table.string('summoner_puuid', 78).notNullable().index()
table.string('match_id', 15).notNullable().index()
})
this.schema.alterTable(this.tableName, (table) => {
table.unique(['summoner_puuid', 'match_id'])
2021-09-12 13:16:08 +00:00
})
}
public async down() {
this.schema.dropTable(this.tableName)
}
}