Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions app/migrations/0012_productive_wallop.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
CREATE TABLE IF NOT EXISTS "crm_leads" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"lead_id" text NOT NULL,
"crm_url" text NOT NULL,
"file_name" text NOT NULL,
"document_url" text NOT NULL,
"transcription_id" uuid,
"extracted_data" jsonb NOT NULL,
"translation" text NOT NULL,
"user_id" text,
"is_default" boolean DEFAULT false NOT NULL,
"createdAt" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "password_reset_tokens" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"username" text NOT NULL,
"token" text NOT NULL,
"expires_at" timestamp NOT NULL,
"createdAt" timestamp DEFAULT now(),
CONSTRAINT "password_reset_tokens_username_unique" UNIQUE("username")
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "crm_leads" ADD CONSTRAINT "crm_leads_transcription_id_transcriptions_id_fk" FOREIGN KEY ("transcription_id") REFERENCES "public"."transcriptions"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "crm_leads" ADD CONSTRAINT "crm_leads_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
Loading