]> Untitled Git - lemmy.git/commitdiff
Add migration to mark local communities as such (#3257)
authorkartikynwa <kartik.ynwa@gmail.com>
Thu, 22 Jun 2023 11:52:31 +0000 (17:22 +0530)
committerGitHub <noreply@github.com>
Thu, 22 Jun 2023 11:52:31 +0000 (07:52 -0400)
migrations/2023-06-22-051755_fix_local_communities_marked_non_local/down.sql [new file with mode: 0644]
migrations/2023-06-22-051755_fix_local_communities_marked_non_local/up.sql [new file with mode: 0644]

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 (file)
index 0000000..ae8c4c7
--- /dev/null
@@ -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 (file)
index 0000000..cbe3be9
--- /dev/null
@@ -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;