
CREATE TABLE tcg.public.TCG_MTG_Card (
	  card_id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY
    , all_parts TEXT
    , arena_id INTEGER
    , artist TEXT
    , artist_ids TEXT
    , booster BOOLEAN
    , border_color TEXT
    , card_back_id TEXT
    , card_faces TEXT
    , cardmarket_id INTEGER
    , cmc DECIMAL(8, 1)
    , collector_number TEXT
    , color_identity TEXT
    , colors TEXT
    , content_warning BOOLEAN
    , digital BOOLEAN
    , edhrec_rank INTEGER
    , finishes TEXT
    , flavor_name TEXT
    , flavor_text TEXT
    , foil BOOLEAN
    , frame TEXT
    , full_art BOOLEAN
    , game_changer BOOLEAN
    , games TEXT
    , hand_modifier TEXT
    , highres_image BOOLEAN
    , id TEXT
    , image_status TEXT
    , image_uri_art_crop TEXT
    , image_uri_border_crop TEXT
    , image_uri_large TEXT
    , image_uri_normal TEXT
    , image_uri_png TEXT
    , image_uri_small TEXT
    , keywords TEXT
    , lang TEXT
    , layout TEXT
    , legal_alchemy BOOLEAN
    , legal_brawl BOOLEAN
    , legal_commander BOOLEAN
    , legal_duel BOOLEAN
    , legal_future BOOLEAN
    , legal_gladiator BOOLEAN
    , legal_historic BOOLEAN
    , legal_legacy BOOLEAN
    , legal_modern BOOLEAN
    , legal_oathbreaker BOOLEAN
    , legal_oldschool BOOLEAN
    , legal_pauper BOOLEAN
    , legal_paupercommander BOOLEAN
    , legal_penny BOOLEAN
    , legal_pioneer BOOLEAN
    , legal_predh BOOLEAN
    , legal_premodern BOOLEAN
    , legal_standard BOOLEAN
    , legal_standardbrawl BOOLEAN
    , legal_timeless BOOLEAN
    , legal_vintage BOOLEAN
    , life_modifier TEXT
    , loyalty TEXT
    , mana_cost TEXT
    , mtgo_id INTEGER
    , multiverse_ids TEXT
    , name TEXT NOT NULL
    , nonfoil BOOLEAN
    , oracle_id TEXT
    , oracle_text TEXT
    , oversized BOOLEAN
    , penny_rank INTEGER
    , power TEXT
    , preview_date DATE
    , preview_source TEXT
    , preview_source_uri TEXT
    , price_eur DECIMAL(10, 3)
    , price_eur_foil DECIMAL(10, 3)
    , price_tix DECIMAL(10, 3)
    , price_usd DECIMAL(10, 3)
    , price_usd_etched DECIMAL(10, 3)
    , price_usd_foil DECIMAL(10, 3)
    , printed_name TEXT
    , printed_text TEXT
    , printed_type_line TEXT
    , prints_search_uri TEXT
    , produced_mana TEXT
    , promo BOOLEAN
    , purchase_cardhoarder TEXT
    , purchase_cardmarket TEXT
    , purchase_tcgplayer TEXT
    , rarity TEXT
    , released_at DATE
    , reprint BOOLEAN
    , reserved BOOLEAN
    , rulings_uri TEXT
    , scryfall_set_uri TEXT
    , scryfall_uri TEXT
    , security_stamp TEXT
    , set TEXT
    , set_id TEXT
    , set_name TEXT
    , set_search_uri TEXT
    , set_type TEXT
    , set_uri TEXT
    , story_spotlight BOOLEAN
    , tcgplayer_id INTEGER
    , textless BOOLEAN
    , toughness TEXT
    , type_line TEXT
    , uri TEXT
    , uri_edhrec TEXT
    , uri_gatherer TEXT
    , uri_tcgplayer_infinite_articles TEXT
    , uri_tcgplayer_infinite_decks TEXT
    , variation BOOLEAN
    , active BOOLEAN NOT NULL DEFAULT TRUE
	, created_on TIMESTAMP NOT NULL
	, created_by_user_id INT NOT NULL
    , CONSTRAINT FK_TCG_MTG_Card_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_Card_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_Card_change_set_id
		FOREIGN KEY (change_set_id)
        REFERENCES tcg.public.TCG_Change_Set(change_set_id)
);