summaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-09-01 09:25:32 +0300
committerrinpatch <rinpatch@sdf.org>2020-09-01 10:45:42 +0300
commit126461942b63bbb74900f296ebcee72d2a33f3d2 (patch)
treedda738dce0a6236e835650abf752d6ec779803ba /priv
parentdc3a418c270e48c6849159097f8bba57d2a2578e (diff)
User table: ensure bio is always a string
Gets rid of '|| ""' in multiple places and fixes #2067
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20200901061256_ensure_bio_is_string.exs7
-rw-r--r--priv/repo/migrations/20200901061637_bio_set_not_null.exs10
2 files changed, 17 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200901061256_ensure_bio_is_string.exs b/priv/repo/migrations/20200901061256_ensure_bio_is_string.exs
new file mode 100644
index 000000000..0e3bb3c81
--- /dev/null
+++ b/priv/repo/migrations/20200901061256_ensure_bio_is_string.exs
@@ -0,0 +1,7 @@
+defmodule Pleroma.Repo.Migrations.EnsureBioIsString do
+ use Ecto.Migration
+
+ def change do
+ execute("update users set bio = '' where bio is null", "")
+ end
+end
diff --git a/priv/repo/migrations/20200901061637_bio_set_not_null.exs b/priv/repo/migrations/20200901061637_bio_set_not_null.exs
new file mode 100644
index 000000000..e3a67d4e7
--- /dev/null
+++ b/priv/repo/migrations/20200901061637_bio_set_not_null.exs
@@ -0,0 +1,10 @@
+defmodule Pleroma.Repo.Migrations.BioSetNotNull do
+ use Ecto.Migration
+
+ def change do
+ execute(
+ "alter table users alter column bio set not null",
+ "alter table users alter column bio drop not null"
+ )
+ end
+end