Brings the working codebase (Next.js app, auth system, Stripe billing, Docker/deploy config, tests, docs) into version control on top of the placeholder initial commit, and adds account self-deletion (Danger Zone in Settings, password + typed-email confirmation, cascading DB cleanup, Stripe cancellation) per GDPR right-to-erasure. Excludes local build caches, node_modules, and internal agent scratch files; .gitignore hardened to keep those out going forward. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
19 lines
1.4 KiB
SQL
19 lines
1.4 KiB
SQL
CREATE TABLE "projects" (
|
|
"id" varchar(64) PRIMARY KEY NOT NULL,
|
|
"user_id" varchar(64) NOT NULL,
|
|
"name" varchar(120) NOT NULL,
|
|
"color" varchar(16),
|
|
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "receipts" ADD COLUMN "project_id" varchar(64);--> statement-breakpoint
|
|
ALTER TABLE "users" ADD COLUMN "monthly_volume" varchar(50);--> statement-breakpoint
|
|
ALTER TABLE "users" ADD COLUMN "export_format" varchar(100);--> statement-breakpoint
|
|
ALTER TABLE "users" ADD COLUMN "main_pain_point" varchar(100);--> statement-breakpoint
|
|
ALTER TABLE "projects" ADD CONSTRAINT "projects_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
CREATE INDEX "idx_projects_user_id" ON "projects" USING btree ("user_id");--> statement-breakpoint
|
|
CREATE INDEX "idx_projects_user_created" ON "projects" USING btree ("user_id","created_at");--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "uq_projects_user_name" ON "projects" USING btree ("user_id","name");--> statement-breakpoint
|
|
ALTER TABLE "receipts" ADD CONSTRAINT "receipts_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
CREATE INDEX "idx_receipts_project" ON "receipts" USING btree ("user_id","project_id"); |