diff --git a/server/migrations/86_add_dc_embedding.down.sql b/server/migrations/86_add_dc_embedding.down.sql index d9c271d844..b705b29b6e 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 28f53d4d13..9d8e28ba77 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}';