From 4996fb07d829a5c93fe97a6f3364f3032fb2c1bb Mon Sep 17 00:00:00 2001 From: lain Date: Sat, 1 Dec 2018 12:00:33 +0100 Subject: [PATCH] Genereate uuids for existing info fields. --- priv/repo/migrations/20181201104428_add_uuid_extension.exs | 7 +++++++ .../migrations/20181201105617_add_uui_ds_to_user_info.exs | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 priv/repo/migrations/20181201104428_add_uuid_extension.exs create mode 100644 priv/repo/migrations/20181201105617_add_uui_ds_to_user_info.exs diff --git a/priv/repo/migrations/20181201104428_add_uuid_extension.exs b/priv/repo/migrations/20181201104428_add_uuid_extension.exs new file mode 100644 index 000000000..2509e558d --- /dev/null +++ b/priv/repo/migrations/20181201104428_add_uuid_extension.exs @@ -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 index 000000000..9571a1e4d --- /dev/null +++ b/priv/repo/migrations/20181201105617_add_uui_ds_to_user_info.exs @@ -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 -- 2.45.2