feat: migrate setup visibility from boolean to three-tier system
Replace isPublic boolean with visibility enum (private/link/public) across the full stack. Add shares table to schema for future share link support. Update all services, routes, schemas, hooks, components, and tests. Plan: 32-01 (Setup Sharing System - Schema Migration) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
17
drizzle-pg/0005_true_green_goblin.sql
Normal file
17
drizzle-pg/0005_true_green_goblin.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
CREATE TABLE "shares" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"setup_id" integer NOT NULL,
|
||||
"token" text NOT NULL,
|
||||
"permission" text DEFAULT 'read' NOT NULL,
|
||||
"expires_at" timestamp,
|
||||
"user_id" integer,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"revoked_at" timestamp,
|
||||
CONSTRAINT "shares_token_unique" UNIQUE("token")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "setups" ADD COLUMN "visibility" text DEFAULT 'private' NOT NULL;--> statement-breakpoint
|
||||
UPDATE "setups" SET "visibility" = 'public' WHERE "is_public" = true;--> statement-breakpoint
|
||||
ALTER TABLE "shares" ADD CONSTRAINT "shares_setup_id_setups_id_fk" FOREIGN KEY ("setup_id") REFERENCES "public"."setups"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "shares" ADD CONSTRAINT "shares_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "setups" DROP COLUMN "is_public";
|
||||
1394
drizzle-pg/meta/0005_snapshot.json
Normal file
1394
drizzle-pg/meta/0005_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -36,6 +36,13 @@
|
||||
"when": 1776016552627,
|
||||
"tag": "0004_smiling_night_nurse",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 5,
|
||||
"version": "7",
|
||||
"when": 1776095449827,
|
||||
"tag": "0005_true_green_goblin",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user