008_discounts.sql 472 B

12345678910111213
  1. -- Migration 008: per-domain discount table
  2. SET search_path TO crawl;
  3. CREATE TABLE IF NOT EXISTS discounts (
  4. id BIGSERIAL PRIMARY KEY,
  5. domain VARCHAR(255) NOT NULL UNIQUE,
  6. discount NUMERIC(5,4) NOT NULL CHECK (discount > 0 AND discount <= 1),
  7. note TEXT,
  8. created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
  9. updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
  10. );
  11. CREATE INDEX IF NOT EXISTS idx_discounts_domain ON discounts (domain);