Files
pig/packages/db/migrations/0007_nasty_vanisher.sql
2026-08-13 01:39:01 -07:00

14 lines
868 B
SQL

CREATE TABLE "import_identities" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"entity" text NOT NULL,
"key_column" text NOT NULL,
"key_value" text NOT NULL,
"record_id" uuid NOT NULL,
"imported_by_user_id" uuid,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "import_identities" ADD CONSTRAINT "import_identities_imported_by_user_id_users_id_fk" FOREIGN KEY ("imported_by_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "import_identities_source_key" ON "import_identities" USING btree ("entity","key_column","key_value");--> statement-breakpoint
CREATE INDEX "import_identities_record_idx" ON "import_identities" USING btree ("entity","record_id");