house tracker: contact status per listing (whose turn, last message, viewing) and labelled filters
Some checks failed
Deploy production / deploy (push) Has been cancelled
Some checks failed
Deploy production / deploy (push) Has been cancelled
This commit is contained in:
17
drizzle/20261025135327_house_contact/migration.sql
Normal file
17
drizzle/20261025135327_house_contact/migration.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
ALTER TABLE "house"."listings" ADD COLUMN "contact_status" text;--> statement-breakpoint
|
||||
ALTER TABLE "house"."listings" ADD COLUMN "contact_at" timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "house"."listings" ADD COLUMN "contact_by" text;--> statement-breakpoint
|
||||
ALTER TABLE "house"."listings" ADD COLUMN "contact_note" text;--> statement-breakpoint
|
||||
ALTER TABLE "house"."listings" ADD COLUMN "contact_ref" text;--> statement-breakpoint
|
||||
ALTER TABLE "house"."listings" ADD COLUMN "viewing_at" timestamp with time zone;--> statement-breakpoint
|
||||
CREATE INDEX "listings_contact_idx" ON "house"."listings" ("contact_status") WHERE contact_status IS NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "house"."listings" ADD CONSTRAINT "listings_contact_status_check" CHECK (contact_status IS NULL OR contact_status IN ('waiting_on_me', 'not_contacted', 'waiting_on_them', 'viewing', 'closed'));--> statement-breakpoint
|
||||
ALTER TABLE "house"."listings" ADD CONSTRAINT "listings_contact_by_check" CHECK (contact_by IS NULL OR contact_by IN ('me', 'them'));--> statement-breakpoint
|
||||
-- house_cli (scripts/house-db.sh) has table-level rights on house.listings, which cover new
|
||||
-- columns; re-granted here so a fresh database gets the same. The role is created out of band.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF current_user = 'personal' AND EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'house_cli') THEN
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON house.listings TO house_cli;
|
||||
END IF;
|
||||
END $$;
|
||||
Reference in New Issue
Block a user