CREATE TABLE IF NOT EXISTS mk_order_price_list_user_price_group (
  user_id     BIGINT NOT NULL,
  price_group TEXT NOT NULL,
  created_at  TIMESTAMPTZ NOT NULL DEFAULT now(),
  updated_at  TIMESTAMPTZ NOT NULL DEFAULT now(),
  PRIMARY KEY (user_id, price_group)
);

CREATE INDEX IF NOT EXISTS ix_order_price_list_user_price_group_user
  ON mk_order_price_list_user_price_group (user_id);

ALTER TABLE mk_order_price_list_user_price_group
  DROP CONSTRAINT IF EXISTS ck_order_price_list_user_price_group;

ALTER TABLE mk_order_price_list_user_price_group
  ADD CONSTRAINT ck_order_price_list_user_price_group
  CHECK (price_group IN (
    'usd1','usd2','usd3','usd4','usd5','usd6',
    'eur1','eur2','eur3','eur4','eur5','eur6',
    'try1','try2','try3','try4','try5','try6'
  ));
