CREATE TABLE IF NOT EXISTS api_kgon_betting_history (
  id                TEXT NOT NULL,
  vendor_id         BIGINT NOT NULL,
  vendor_name       TEXT NOT NULL,
  game_id           BIGINT NOT NULL,
  game_name         TEXT NOT NULL,
  game_category     TEXT NOT NULL,
  game_type         TEXT NOT NULL,
  currency          TEXT NOT NULL,
  cash              DOUBLE PRECISION,
  before_cash       DOUBLE PRECISION,
  after_cash        DOUBLE PRECISION,
  group_key         TEXT,
  detail            TEXT,
  is_bonus          BOOLEAN NOT NULL,
  is_promo          BOOLEAN NOT NULL,
  is_jackpot        BOOLEAN NOT NULL,
  site_username     TEXT NOT NULL,
  key               TEXT NOT NULL,
  ref_id            TEXT NOT NULL,
  o_ref_id          TEXT,
  betting_type      TEXT NOT NULL,
  category          TEXT NOT NULL,
  created_at        BIGINT NOT NULL,
  utc_created_at    BIGINT NOT NULL,
  PRIMARY KEY (id)
);

CREATE INDEX idx_api_kgon_betting_history_vendor_id ON api_kgon_betting_history (vendor_id);
CREATE INDEX idx_api_kgon_betting_history_game_id ON api_kgon_betting_history (game_id);
CREATE INDEX idx_api_kgon_betting_history_created_at ON api_kgon_betting_history (created_at);
CREATE INDEX idx_api_kgon_betting_history_utc_created_at ON api_kgon_betting_history (utc_created_at);
CREATE INDEX idx_api_kgon_betting_history_site_username ON api_kgon_betting_history (site_username);
