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>
15 lines
869 B
SQL
15 lines
869 B
SQL
CREATE TABLE "security_events" (
|
|
"id" varchar(64) PRIMARY KEY NOT NULL,
|
|
"type" varchar(64) NOT NULL,
|
|
"user_id" varchar(64),
|
|
"email" varchar(255),
|
|
"ip_hash" varchar(64),
|
|
"user_agent" varchar(255),
|
|
"metadata_json" jsonb,
|
|
"created_at" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "security_events" ADD CONSTRAINT "security_events_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
CREATE INDEX "idx_security_events_type_created" ON "security_events" USING btree ("type","created_at");--> statement-breakpoint
|
|
CREATE INDEX "idx_security_events_user_created" ON "security_events" USING btree ("user_id","created_at");--> statement-breakpoint
|
|
CREATE INDEX "idx_security_events_ip_created" ON "security_events" USING btree ("ip_hash","created_at"); |