DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

4e3f0c976df59b4b6cbe9821fcba8dda0f9df5ff — Jonni Liljamo 1 year, 10 months ago aac71f7
feat(api): migration create_actions
A api/migrations/2023-02-17-085421_create_actions/down.sql => api/migrations/2023-02-17-085421_create_actions/down.sql +3 -0
@@ 0,0 1,3 @@
-- This file should undo anything in `up.sql`

DROP TABLE actions;

A api/migrations/2023-02-17-085421_create_actions/up.sql => api/migrations/2023-02-17-085421_create_actions/up.sql +13 -0
@@ 0,0 1,13 @@
-- Your SQL goes here

CREATE TABLE actions (
    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,
    game_data_id uuid REFERENCES gamedata(id) NOT NULL,
    invoker uuid REFERENCES users(id) NOT NULL,
    data json NOT NULL,
    timestamp TIMESTAMP NOT NULL DEFAULT current_timestamp
);

SELECT diesel_manage_updated_at('actions');

M api/src/schema.rs => api/src/schema.rs +2 -0
@@ 5,6 5,7 @@ diesel::table! {
        id -> Uuid,
        created_at -> Timestamp,
        updated_at -> Timestamp,
        game_data_id -> Uuid,
        invoker -> Uuid,
        data -> Json,
        timestamp -> Timestamp,


@@ 35,6 36,7 @@ diesel::table! {
    }
}

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

diesel::allow_tables_to_appear_in_same_query!(