
CREATE TABLE tcg.public.TCG_MTG_Game (
	  game_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY
    , notes TEXT
    , is_commander BOOLEAN NOT NULL DEFAULT TRUE
    , is_draft BOOLEAN NOT NULL DEFAULT FALSE
    , is_sealed BOOLEAN NOT NULL DEFAULT FALSE
    , location_name TEXT
    , start_on TIMESTAMP
    , end_on TIMESTAMP
    , starting_life INT NOT NULL
    , active BOOLEAN NOT NULL DEFAULT TRUE
	, created_on TIMESTAMP NOT NULL
	, created_by_user_id INT NOT NULL
    , CONSTRAINT FK_TCG_MTG_Game_created_by_user_id
        FOREIGN KEY (created_by_user_id)
        REFERENCES tcg.public.TCG_User(user_id)
	, updated_last_on TIMESTAMP NOT NULL
	, updated_last_by_user_id INT NOT NULL
    , CONSTRAINT FK_TCG_MTG_Game_updated_last_by_user_id
        FOREIGN KEY (updated_last_by_user_id)
        REFERENCES tcg.public.TCG_User(user_id)
    , change_set_id INT NOT NULL
    , CONSTRAINT FK_TCG_MTG_Game_change_set_id
		FOREIGN KEY (change_set_id)
        REFERENCES tcg.public.TCG_Change_Set(change_set_id)
);
