From 4f2fb68d6b469e7a531d9537a79c82d6c2202245 Mon Sep 17 00:00:00 2001 From: kartikynwa Date: Thu, 22 Jun 2023 17:22:31 +0530 Subject: [PATCH] Add migration to mark local communities as such (#3257) --- .../down.sql | 2 ++ .../up.sql | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 migrations/2023-06-22-051755_fix_local_communities_marked_non_local/down.sql create mode 100644 migrations/2023-06-22-051755_fix_local_communities_marked_non_local/up.sql diff --git a/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/down.sql b/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/down.sql new file mode 100644 index 00000000..ae8c4c78 --- /dev/null +++ b/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/down.sql @@ -0,0 +1,2 @@ +-- Add a no-op statement to prevent `diesel migration redo` errors +SELECT 1; diff --git a/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/up.sql b/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/up.sql new file mode 100644 index 00000000..cbe3be9e --- /dev/null +++ b/migrations/2023-06-22-051755_fix_local_communities_marked_non_local/up.sql @@ -0,0 +1,5 @@ +update community c +set local=true +from local_site ls + join site s on ls.site_id=s.id +where c.instance_id=s.instance_id and not c.local; -- 2.44.1