From 708d15629cb9feb485ec0644e628dcd82fd857f0 Mon Sep 17 00:00:00 2001 From: Padreug Date: Tue, 5 May 2026 18:13:39 +0200 Subject: [PATCH] chore: bump to v1.3.0-aio.1 and make m006 idempotent Sets the rebase foundation: version metadata, point repo at the aio fork, and a duplicate-column-tolerant m006 so AIO installs that already ran our pre-rebase m007_add_extra_fields don't fail when LNbits replays upstream's m006 under its new name. Co-Authored-By: Claude Opus 4.7 (1M context) --- config.json | 9 +++++++-- migrations.py | 28 +++++++++++++++++++++------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/config.json b/config.json index 11bd0b1..3b7390b 100644 --- a/config.json +++ b/config.json @@ -1,8 +1,8 @@ { "id": "events", - "version": "1.3.0", + "version": "1.3.0-aio.1", "name": "Events", - "repo": "https://github.com/lnbits/events", + "repo": "https://git.atitlan.io/aiolabs/events", "short_description": "Sell and register event tickets", "description": "", "tile": "/events/static/image/events.png", @@ -32,6 +32,11 @@ "name": "motorina0", "uri": "https://github.com/motorina0", "role": "Developer" + }, + { + "name": "padreug", + "uri": "https://git.atitlan.io/padreug", + "role": "Developer (aio fork: approval workflow + NIP-52 Nostr sync)" } ], "images": [ diff --git a/migrations.py b/migrations.py index 6f8e838..c055617 100644 --- a/migrations.py +++ b/migrations.py @@ -162,16 +162,30 @@ async def m005_add_image_banner(db): await db.execute("ALTER TABLE events.events ADD COLUMN banner TEXT;") +async def _alter_add_column_safe(db, sql: str) -> None: + """ALTER TABLE ADD COLUMN that swallows duplicate-column errors. + + Earlier aiolabs/events forks added some of these columns under different + migration names (e.g. our former m007). Skipping the error keeps the + migration log monotonic for both fresh installs and pre-rebase upgrades. + """ + try: + await db.execute(sql) + except Exception as exc: + msg = str(exc).lower() + if "duplicate column" in msg or "already exists" in msg: + return + raise + + async def m006_add_extra_fields(db): """ Add a canceled and 'extra' column to events and ticket tables to support promo codes and ticket metadata. """ - # Add canceled and 'extra' columns to events table - await db.execute( - "ALTER TABLE events.events ADD COLUMN canceled BOOLEAN NOT NULL DEFAULT FALSE;" + await _alter_add_column_safe( + db, + "ALTER TABLE events.events ADD COLUMN canceled BOOLEAN NOT NULL DEFAULT FALSE", ) - await db.execute("ALTER TABLE events.events ADD COLUMN extra TEXT;") - - # Add 'extra' column to ticket table - await db.execute("ALTER TABLE events.ticket ADD COLUMN extra TEXT;") + await _alter_add_column_safe(db, "ALTER TABLE events.events ADD COLUMN extra TEXT") + await _alter_add_column_safe(db, "ALTER TABLE events.ticket ADD COLUMN extra TEXT")