-- Product brands: reference data like categories, administered centrally and -- referenced by products. A brand can be retired without touching its products. CREATE TABLE brands ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), name JSONB NOT NULL, slug TEXT NOT NULL UNIQUE, position INT NOT NULL DEFAULT 0, active BOOLEAN NOT NULL DEFAULT TRUE, created_at TIMESTAMPTZ NOT NULL DEFAULT now() ); ALTER TABLE products ADD COLUMN brand_id UUID REFERENCES brands (id) ON DELETE SET NULL; CREATE INDEX products_brand_idx ON products (brand_id);