DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

aac71f7a39f36f8f79742a83f31b4d51fd857dfe — Jonni Liljamo 1 year, 8 months ago a17eeda
feat(api): migration create_gamedata
A api/migrations/2023-02-17-085226_create_gamedata/down.sql => api/migrations/2023-02-17-085226_create_gamedata/down.sql +3 -0
@@ 0,0 1,3 @@
-- This file should undo anything in `up.sql`

DROP TABLE gamedata;

A api/migrations/2023-02-17-085226_create_gamedata/up.sql => api/migrations/2023-02-17-085226_create_gamedata/up.sql +14 -0
@@ 0,0 1,14 @@
-- Your SQL goes here

CREATE TABLE gamedata (
    id uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(),
    created_at TIMESTAMP NOT NULL DEFAULT current_timestamp,
    updated_at TIMESTAMP NOT NULL DEFAULT current_timestamp,
    turn SMALLINT NOT NULL,
    host_hand json,
    host_deck json,
    guest_hand json,
    guest_deck json
);

SELECT diesel_manage_updated_at('gamedata');

M api/src/schema.rs => api/src/schema.rs +32 -0
@@ 1,6 1,30 @@
// @generated automatically by Diesel CLI.

diesel::table! {
    actions (id) {
        id -> Uuid,
        created_at -> Timestamp,
        updated_at -> Timestamp,
        invoker -> Uuid,
        data -> Json,
        timestamp -> Timestamp,
    }
}

diesel::table! {
    gamedata (id) {
        id -> Uuid,
        created_at -> Timestamp,
        updated_at -> Timestamp,
        turn -> Int2,
        host_hand -> Nullable<Json>,
        host_deck -> Nullable<Json>,
        guest_hand -> Nullable<Json>,
        guest_deck -> Nullable<Json>,
    }
}

diesel::table! {
    users (id) {
        id -> Uuid,
        created_at -> Timestamp,


@@ 10,3 34,11 @@ diesel::table! {
        password -> Varchar,
    }
}

diesel::joinable!(actions -> users (invoker));

diesel::allow_tables_to_appear_in_same_query!(
    actions,
    gamedata,
    users,
);