- gateway, companies, customers, job_seekers apps updated - users config/mod/mail handlers - auth middleware and jwt crate updates - db models: user, config, mod updates - all remaining migrations: portfolio, notifications, reviews, kb, support, coupons, onboarding states Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15 lines
806 B
SQL
15 lines
806 B
SQL
-- Reviews: customers leave reviews on professionals after an accepted lead
|
|
CREATE TABLE IF NOT EXISTS reviews (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
lead_request_id UUID NOT NULL REFERENCES lead_requests(id) ON DELETE CASCADE UNIQUE,
|
|
customer_id UUID NOT NULL REFERENCES customers(id) ON DELETE CASCADE,
|
|
professional_id UUID NOT NULL REFERENCES professionals(id) ON DELETE CASCADE,
|
|
rating SMALLINT NOT NULL CHECK (rating >= 1 AND rating <= 5),
|
|
comment TEXT,
|
|
is_published BOOLEAN NOT NULL DEFAULT true,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_reviews_professional_id ON reviews(professional_id);
|
|
CREATE INDEX IF NOT EXISTS idx_reviews_customer_id ON reviews(customer_id);
|