diff --git a/backend/migrations/20220315171314_games.ts b/backend/migrations/20220315171314_games.ts new file mode 100644 index 0000000000000000000000000000000000000000..703e2d7a40af16e6c598f14e5f4da90015023f0f --- /dev/null +++ b/backend/migrations/20220315171314_games.ts @@ -0,0 +1,13 @@ +import { Knex } from "knex"; + +export async function up(knex: Knex): Promise<void> { + return knex.schema.createTable("games", function (table) { + table.uuid("id").primary().defaultTo(knex.raw("gen_random_uuid()")); + table.timestamp("began_at"); + table.timestamp("ended_at"); + }); +} + +export async function down(knex: Knex): Promise<void> { + return knex.schema.dropTable("games"); +} diff --git a/backend/migrations/20220315171328_clues.ts b/backend/migrations/20220315171328_clues.ts new file mode 100644 index 0000000000000000000000000000000000000000..e8d57a091c938be5531431817185ef7aa6cc97ed --- /dev/null +++ b/backend/migrations/20220315171328_clues.ts @@ -0,0 +1,15 @@ +import { Knex } from "knex"; + +export async function up(knex: Knex): Promise<void> { + return knex.schema.createTable("clues", function (table) { + table.uuid("id").primary().defaultTo(knex.raw("gen_random_uuid()")); + table.uuid("game_id").references("games.id").notNullable(); + table.uuid("word_id").references("words.id").notNullable(); + table.timestamp("began_at"); + table.timestamp("ended_at"); + }); +} + +export async function down(knex: Knex): Promise<void> { + return knex.schema.dropTable("clues"); +} diff --git a/backend/migrations/20220315171336_shots.ts b/backend/migrations/20220315171336_shots.ts new file mode 100644 index 0000000000000000000000000000000000000000..9781b2aa7d3c4d54e82d379a50700f1872381eb7 --- /dev/null +++ b/backend/migrations/20220315171336_shots.ts @@ -0,0 +1,17 @@ +import { Knex } from "knex"; + +export async function up(knex: Knex): Promise<void> { + return knex.schema.createTable("shots", function (table) { + table.uuid("id").primary().defaultTo(knex.raw("gen_random_uuid()")); + table.uuid("game_id").references("games.id").notNullable(); + table.uuid("clue_id").references("clues.id"); + table.timestamp("began_at"); + table.timestamp("ended_at"); + table.string("typed"); + table.string("final"); + }); +} + +export async function down(knex: Knex): Promise<void> { + return knex.schema.dropTable("shots"); +}