All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 27s
Build and Push Docker Images / build-frontend (push) Successful in 1m11s
Build and Push Docker Images / build-website (push) Successful in 18s
Build and Push Docker Images / build-docs (push) Successful in 16s
23 lines
776 B
SQL
23 lines
776 B
SQL
ALTER TABLE "tenant_export_jobs"
|
|
ADD COLUMN IF NOT EXISTS "operation" text DEFAULT 'export' NOT NULL,
|
|
ADD COLUMN IF NOT EXISTS "previous_tenant_locked" "locked_tenant";
|
|
|
|
ALTER TABLE "tenants"
|
|
ADD COLUMN IF NOT EXISTS "locked_by_export_job_id" uuid;
|
|
|
|
DO $$
|
|
BEGIN
|
|
IF NOT EXISTS (
|
|
SELECT 1
|
|
FROM information_schema.table_constraints
|
|
WHERE constraint_schema = 'public'
|
|
AND constraint_name = 'tenants_locked_by_export_job_id_tenant_export_jobs_id_fk'
|
|
) THEN
|
|
ALTER TABLE "tenants"
|
|
ADD CONSTRAINT "tenants_locked_by_export_job_id_tenant_export_jobs_id_fk"
|
|
FOREIGN KEY ("locked_by_export_job_id")
|
|
REFERENCES "tenant_export_jobs"("id")
|
|
ON DELETE SET NULL;
|
|
END IF;
|
|
END $$;
|