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")