diff options
Diffstat (limited to 'db/migrations/0275_busy_madelyne_pryor.sql')
| -rw-r--r-- | db/migrations/0275_busy_madelyne_pryor.sql | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/db/migrations/0275_busy_madelyne_pryor.sql b/db/migrations/0275_busy_madelyne_pryor.sql new file mode 100644 index 00000000..f3f33621 --- /dev/null +++ b/db/migrations/0275_busy_madelyne_pryor.sql @@ -0,0 +1,76 @@ +CREATE TABLE "knox"."approval_lines" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "name" text NOT NULL, + "description" text, + "category" text, + "aplns" jsonb NOT NULL, + "createdBy" integer NOT NULL, + "createdAt" timestamp DEFAULT now() NOT NULL, + "updatedAt" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "knox"."approval_logs" ( + "ap_inf_id" text PRIMARY KEY NOT NULL, + "user_id" text NOT NULL, + "ep_id" text NOT NULL, + "email_address" text NOT NULL, + "subject" text NOT NULL, + "content" text NOT NULL, + "status" text NOT NULL, + "aplns" jsonb NOT NULL, + "is_deleted" boolean DEFAULT false NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "knox"."approval_template_history" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "templateId" uuid NOT NULL, + "version" integer NOT NULL, + "subject" text NOT NULL, + "content" text NOT NULL, + "changeDescription" text, + "changedBy" integer NOT NULL, + "createdAt" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "knox"."approval_template_variables" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "approvalTemplateId" uuid, + "variableName" text NOT NULL, + "variableType" text NOT NULL, + "defaultValue" text, + "description" text, + "createdBy" integer NOT NULL, + "createdAt" timestamp DEFAULT now() NOT NULL, + "updatedAt" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "knox"."approval_templates" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "name" text NOT NULL, + "subject" text NOT NULL, + "content" text NOT NULL, + "description" text, + "category" text, + "approvalLineId" uuid, + "createdBy" integer NOT NULL, + "createdAt" timestamp DEFAULT now() NOT NULL, + "updatedAt" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +ALTER TABLE "knox"."approval" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint +DROP TABLE "knox"."approval" CASCADE;--> statement-breakpoint +ALTER TABLE "procurement_rfqs" DROP CONSTRAINT "procurement_rfqs_project_id_projects_id_fk"; +--> statement-breakpoint +ALTER TABLE "procurement_rfqs" ALTER COLUMN "project_id" SET DATA TYPE varchar(1000);--> statement-breakpoint +ALTER TABLE "procurement_rfqs" ALTER COLUMN "due_date" DROP NOT NULL;--> statement-breakpoint +ALTER TABLE "projects" ADD COLUMN "pspid" char(24);--> statement-breakpoint +ALTER TABLE "knox"."approval_lines" ADD CONSTRAINT "approval_lines_createdBy_users_id_fk" FOREIGN KEY ("createdBy") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "knox"."approval_template_history" ADD CONSTRAINT "approval_template_history_templateId_approval_templates_id_fk" FOREIGN KEY ("templateId") REFERENCES "knox"."approval_templates"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "knox"."approval_template_history" ADD CONSTRAINT "approval_template_history_changedBy_users_id_fk" FOREIGN KEY ("changedBy") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "knox"."approval_template_variables" ADD CONSTRAINT "approval_template_variables_approvalTemplateId_approval_templates_id_fk" FOREIGN KEY ("approvalTemplateId") REFERENCES "knox"."approval_templates"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "knox"."approval_template_variables" ADD CONSTRAINT "approval_template_variables_createdBy_users_id_fk" FOREIGN KEY ("createdBy") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "knox"."approval_templates" ADD CONSTRAINT "approval_templates_approvalLineId_approval_lines_id_fk" FOREIGN KEY ("approvalLineId") REFERENCES "knox"."approval_lines"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "knox"."approval_templates" ADD CONSTRAINT "approval_templates_createdBy_users_id_fk" FOREIGN KEY ("createdBy") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "projects" ADD CONSTRAINT "projects_pspid_unique" UNIQUE("pspid");
\ No newline at end of file |
