Genereate uuids for existing info fields.
authorlain <lain@soykaf.club>
Sat, 1 Dec 2018 11:00:33 +0000 (12:00 +0100)
committerlain <lain@soykaf.club>
Sat, 1 Dec 2018 11:00:33 +0000 (12:00 +0100)
priv/repo/migrations/20181201104428_add_uuid_extension.exs [new file with mode: 0644]
priv/repo/migrations/20181201105617_add_uui_ds_to_user_info.exs [new file with mode: 0644]

diff --git a/priv/repo/migrations/20181201104428_add_uuid_extension.exs b/priv/repo/migrations/20181201104428_add_uuid_extension.exs
new file mode 100644 (file)
index 0000000..2509e55
--- /dev/null
@@ -0,0 +1,7 @@
+defmodule Pleroma.Repo.Migrations.AddUUIDExtension do
+  use Ecto.Migration
+
+  def change do
+    execute("create extension if not exists \"uuid-ossp\"")
+  end
+end
diff --git a/priv/repo/migrations/20181201105617_add_uui_ds_to_user_info.exs b/priv/repo/migrations/20181201105617_add_uui_ds_to_user_info.exs
new file mode 100644 (file)
index 0000000..9571a1e
--- /dev/null
@@ -0,0 +1,7 @@
+defmodule Pleroma.Repo.Migrations.AddUUIDsToUserInfo do
+  use Ecto.Migration
+
+  def change do
+    execute("update users set info = jsonb_set(info, '{\"id\"}', to_jsonb(uuid_generate_v4()))")
+  end
+end