CREATE TABLE IF NOT EXISTS payment_expected_contracts (
  id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
  purchase_id uuid NOT NULL,
  order_id uuid NOT NULL,
  amount_agorot integer NOT NULL,
  currency text NOT NULL,
  customer_id text,
  destination_account_id text NOT NULL,
  application_fee_agorot integer NOT NULL,
  effect_key text NOT NULL UNIQUE,
  binding_source text NOT NULL DEFAULT 'checkout',
  created_at timestamptz NOT NULL DEFAULT now(),
  CONSTRAINT payment_expected_contract_purchase_uniq UNIQUE (purchase_id)
);
