"""a link preview's insert, update or delete bumps its note's sync revision Revision ID: 0031 Revises: 0030 Create Date: 2026-10-07 0015 made every child table bump its parent note's `sync_revision`, so a note syncs as a whole. `note_link_previews` arrived later (0020) and was never added, and two things have been missing on every linked device since: - A preview fetched in the background after a save (`unfurl_queue.py`) never reached a device that had already pulled the note. The note's revision was assigned when the TEXT was saved, before the preview existed, and nothing moved it afterwards. - A preview dismissed on the web stayed on every other device, for the same reason. The trigger is the same function 0015 installs on the other child tables. ## Downgrade Drops the trigger. Previews go back to not propagating; nothing is lost. """ from alembic import op revision = "0031" down_revision = "0030" branch_labels = None depends_on = None def upgrade() -> None: op.execute( "CREATE TRIGGER trg_note_link_previews_bump_note AFTER INSERT OR UPDATE OR DELETE " "ON note_link_previews FOR EACH ROW EXECUTE PROCEDURE ts_bump_parent_note_revision()" ) def downgrade() -> None: op.execute("DROP TRIGGER IF EXISTS trg_note_link_previews_bump_note ON note_link_previews")