LeagueStats/server/database/migrations/1631807093726_match_player_ranks.ts

31 lines
933 B
TypeScript
Raw Normal View History

2021-09-16 20:29:20 +00:00
import BaseSchema from '@ioc:Adonis/Lucid/Schema'
export default class MatchPlayerRanks extends BaseSchema {
protected tableName = 'match_player_ranks'
public async up() {
this.schema.createTable(this.tableName, (table) => {
table.increments('id')
2021-09-19 15:47:07 +00:00
table.integer('player_id').unsigned().notNullable().index()
2021-09-16 20:29:20 +00:00
table.specificType('gamemode', 'smallint').notNullable()
2021-09-16 20:29:20 +00:00
table.string('tier', 11).notNullable()
table.specificType('rank', 'smallint').notNullable()
table.specificType('lp', 'smallint').unsigned().notNullable()
table.specificType('wins', 'smallint').unsigned().notNullable()
table.specificType('losses', 'smallint').unsigned().notNullable()
2021-09-16 20:29:20 +00:00
/**
* Uses timestamptz for PostgreSQL and DATETIME2 for MSSQL
*/
table.timestamp('created_at', { useTz: true })
})
}
public async down() {
this.schema.dropTable(this.tableName)
}
}