mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-03 21:28:57 +01:00
Idempotent-ise schema update script
If any ASes don't have an ID, the schema will fail, and then it will error when trying to add the column again.
This commit is contained in:
parent
95481e7ba7
commit
edca2d9891
1 changed files with 5 additions and 1 deletions
|
@ -20,7 +20,11 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
def run_upgrade(cur, database_engine, config, *args, **kwargs):
|
def run_upgrade(cur, database_engine, config, *args, **kwargs):
|
||||||
# NULL indicates user was not registered by an appservice.
|
# NULL indicates user was not registered by an appservice.
|
||||||
cur.execute("ALTER TABLE users ADD COLUMN appservice_id TEXT")
|
try:
|
||||||
|
cur.execute("ALTER TABLE users ADD COLUMN appservice_id TEXT")
|
||||||
|
except:
|
||||||
|
# Maybe we already added the column? Hope so...
|
||||||
|
pass
|
||||||
|
|
||||||
cur.execute("SELECT name FROM users")
|
cur.execute("SELECT name FROM users")
|
||||||
rows = cur.fetchall()
|
rows = cur.fetchall()
|
||||||
|
|
Loading…
Reference in a new issue