Add signature verification and lossless event tag storage

This commit is contained in:
2026-03-14 04:20:42 +01:00
parent 18e429e05a
commit e12085af2f
8 changed files with 152 additions and 46 deletions

View File

@@ -0,0 +1,24 @@
defmodule Parrhesia.Repo.Migrations.AddEventsTagsJsonb do
use Ecto.Migration
def up do
execute("ALTER TABLE events ADD COLUMN tags jsonb NOT NULL DEFAULT '[]'::jsonb")
execute("""
UPDATE events AS event
SET tags = COALESCE(
(
SELECT jsonb_agg(jsonb_build_array(tag.name, tag.value) ORDER BY tag.idx)
FROM event_tags AS tag
WHERE tag.event_created_at = event.created_at
AND tag.event_id = event.id
),
'[]'::jsonb
)
""")
end
def down do
execute("ALTER TABLE events DROP COLUMN tags")
end
end