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 000000000..ae8c4c786 --- /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 000000000..cbe3be9e5 --- /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;