
CREATE TABLE tcg.public.TCG_MTG_Inventory_Temp (
	  temp_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY
    , inventory_id INT
    , card_id INT
    , finish_id INT NOT NULL
    , condition_id INT NOT NULL
    , sleeve_colour_name TEXT
    , location_name TEXT
    , acquired_from TEXT
    , acquired_on TIMESTAMP
    , cost_gbp DECIMAL(6, 2) NOT NULL
    , sale_price_gbp DECIMAL(6, 2)
    , is_sold BOOLEAN NOT NULL DEFAULT FALSE
    , is_destroyed BOOLEAN NOT NULL DEFAULT FALSE
    , notes TEXT
    , alterations_customisations TEXT
    , grading_company_name TEXT
    , grading_score TEXT
    , subgrades TEXT
    , misprint_errors TEXT
    , miscut_errors TEXT
    , playability TEXT
    , owner_user_id INT NOT NULL
    , ownership_status_name TEXT
    , trading_status_name TEXT
    , loaned_to_user_id INT
    , loan_start_on TIMESTAMP
    , loan_end_on TIMESTAMP
    , provenance TEXT
    , signed_by_names TEXT
    , signature_condition_name TEXT
    , token_rear_side_card_id INT
    , display_order INT NOT NULL
    , active BOOLEAN NOT NULL DEFAULT TRUE
	-- , created_on TIMESTAMP NOT NULL
	, created_by_user_id INT NOT NULL
	-- , updated_last_on TIMESTAMP NOT NULL
	, updated_last_by_user_id INT NOT NULL
    , change_set_id INT NOT NULL
    
    , guid UUID NOT NULL
    , set_code TEXT
    , collector_number TEXT
    , name TEXT
    , is_token BOOLEAN
    , token_rear_side_name TEXT
    , token_rear_side_set_code TEXT
    , token_rear_side_collector_number TEXT
);
