mirror of
https://github.com/basicswap/basicswap.git
synced 2025-04-24 23:18:22 +00:00
Properly update db
This commit is contained in:
parent
f66f857b35
commit
b1eee8cc16
1 changed files with 1 additions and 18 deletions
|
@ -427,24 +427,7 @@ def upgradeDatabase(self, db_version):
|
|||
)
|
||||
elif current_version == 26:
|
||||
db_version += 1
|
||||
# First add the column
|
||||
cursor.execute(
|
||||
"ALTER TABLE offers ADD COLUMN auto_accept_type INTEGER NOT NULL DEFAULT 0"
|
||||
)
|
||||
|
||||
# Then update existing rows based on auto_accept_bids
|
||||
cursor.execute(
|
||||
"""
|
||||
UPDATE offers
|
||||
SET auto_accept_type = CASE
|
||||
WHEN auto_accept_bids = 1 THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
WHERE auto_accept_type IS NULL
|
||||
"""
|
||||
)
|
||||
|
||||
self.commitDB()
|
||||
cursor.execute("ALTER TABLE offers ADD COLUMN auto_accept_type INTEGER")
|
||||
if current_version != db_version:
|
||||
self.db_version = db_version
|
||||
self.setIntKV("db_version", db_version, cursor)
|
||||
|
|
Loading…
Reference in a new issue