From da155464fa3409a02b72da0faf38625224fc7ef7 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 17 May 2024 15:08:48 +0530 Subject: [PATCH] Remove updated_at trigger for embeddings table --- server/migrations/86_add_dc_embedding.down.sql | 16 ++++++++++++++++ server/migrations/86_add_dc_embedding.up.sql | 1 + 2 files changed, 17 insertions(+) diff --git a/server/migrations/86_add_dc_embedding.down.sql b/server/migrations/86_add_dc_embedding.down.sql index d9c271d84..b705b29b6 100644 --- a/server/migrations/86_add_dc_embedding.down.sql +++ b/server/migrations/86_add_dc_embedding.down.sql @@ -1,2 +1,18 @@ -- Add types for the new dcs that are introduced for the derived data ALTER TABLE embeddings DROP COLUMN IF EXISTS datacenters; + +DO +$$ + BEGIN + IF NOT EXISTS (SELECT 1 FROM pg_trigger WHERE tgname = 'update_embeddings_updated_at') THEN + CREATE TRIGGER update_embeddings_updated_at + BEFORE UPDATE + ON embeddings + FOR EACH ROW + EXECUTE PROCEDURE + trigger_updated_at_microseconds_column(); + ELSE + RAISE NOTICE 'Trigger update_embeddings_updated_at already exists.'; + END IF; + END +$$; \ No newline at end of file diff --git a/server/migrations/86_add_dc_embedding.up.sql b/server/migrations/86_add_dc_embedding.up.sql index 28f53d4d1..9d8e28ba7 100644 --- a/server/migrations/86_add_dc_embedding.up.sql +++ b/server/migrations/86_add_dc_embedding.up.sql @@ -1,3 +1,4 @@ -- Add types for the new dcs that are introduced for the derived data ALTER TYPE s3region ADD VALUE 'wasabi-eu-central-2-derived'; +DROP TRIGGER IF EXISTS update_embeddings_updated_at ON embeddings; ALTER TABLE embeddings ADD COLUMN IF NOT EXISTS datacenters s3region[] default '{b2-eu-cen}';