CREATE TABLE IF NOT EXISTS api_kgon_games (
  id                BIGINT NOT NULL,
  vendor_id         BIGINT NOT NULL,
  key               TEXT NOT NULL,
  names             TEXT NOT NULL,
  platform          TEXT NOT NULL,
  category          TEXT NOT NULL,
  game_type         TEXT NOT NULL,
  image             TEXT,
  created_at        BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
  updated_at        BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000),
  PRIMARY KEY (id),
  CONSTRAINT fk_api_kgon_games_vendor_id
    FOREIGN KEY(vendor_id) 
	    REFERENCES api_kgon_vendors(id)
);

-- trigger (updated_at)
CREATE TRIGGER tg_api_kgon_games_updated_at
  BEFORE UPDATE
  ON api_kgon_games
  FOR EACH ROW
  EXECUTE PROCEDURE update_updated_at_column();
