From 46c2db4b7c8ac8c9d5ca1853f0260ceb520855b4 Mon Sep 17 00:00:00 2001 From: Johanna Larsson Date: Sat, 18 Jul 2026 20:57:28 +0000 Subject: [PATCH] Finish migration to did in atproto_sessions Ran this on the server first ```elixir AnnotAt.Repo.query!(""" UPDATE atproto_sessions s SET did = u.did, pds_host = u.pds_host FROM users u WHERE s.user_id = u.id """) ``` --- priv/repo/migrations/20260718205540_finish_atproto_sessions_rekey.exs | 21 +++++++++++++++++++++ 1 file(s) changed, 21 insertion(s)(+), 0 deletion(s)(-) diff --git a/priv/repo/migrations/20260718205540_finish_atproto_sessions_rekey.exs b/priv/repo/migrations/20260718205540_finish_atproto_sessions_rekey.exs new file mode 100644 --- /dev/null +++ b/priv/repo/migrations/20260718205540_finish_atproto_sessions_rekey.exs @@ -0,0 +1,21 @@ +defmodule AnnotAt.Repo.Migrations.FinishAtprotoSessionsRekey do + use Ecto.Migration + + def up do + alter table(:atproto_sessions) do + modify :did, :text, null: false + modify :pds_host, :text, null: false + remove :user_id + end + end + + def down do + alter table(:atproto_sessions) do + add :user_id, references(:users, on_delete: :delete_all) + remove :did + remove :pds_host + end + + create unique_index(:atproto_sessions, [:user_id]) + end +end -- tangled.sh