]> Untitled Git - lemmy.git/commitdiff
Fixing wrong user_ and community icon and banner urls.
authorDessalines <tyhou13@gmx.com>
Thu, 4 Mar 2021 04:40:00 +0000 (23:40 -0500)
committerDessalines <tyhou13@gmx.com>
Thu, 4 Mar 2021 04:40:00 +0000 (23:40 -0500)
- Fixes #1477

docker/dev/volume_mount.dockerfile
migrations/2021-03-04-040229_clean_icon_urls/down.sql [new file with mode: 0644]
migrations/2021-03-04-040229_clean_icon_urls/up.sql [new file with mode: 0644]

index 62d77fa36053d5adb604adaf9c5d9862341dbf9d..0cb036247186a2a9d86750bd10a19dd3dfbcb0b5 100644 (file)
@@ -1,4 +1,6 @@
 # syntax=docker/dockerfile:experimental
+
+# Warning: this will not pick up migrations unless there are code changes
 FROM rust:1.50-buster as rust
 
 ENV HOME=/home/root
diff --git a/migrations/2021-03-04-040229_clean_icon_urls/down.sql b/migrations/2021-03-04-040229_clean_icon_urls/down.sql
new file mode 100644 (file)
index 0000000..f866b15
--- /dev/null
@@ -0,0 +1,3 @@
+-- This is a clean-up migration that cannot be undone,
+-- but Diesel requires a non-empty script so run a no-op.
+SELECT 1;
diff --git a/migrations/2021-03-04-040229_clean_icon_urls/up.sql b/migrations/2021-03-04-040229_clean_icon_urls/up.sql
new file mode 100644 (file)
index 0000000..8b22b33
--- /dev/null
@@ -0,0 +1,5 @@
+-- If these are not urls, it will crash the server
+update user_ set avatar = NULL where avatar not like 'http%';
+update user_ set banner = NULL where banner not like 'http%';
+update community set icon = NULL where icon not like 'http%';
+update community set banner = NULL where banner not like 'http%';