Skip to content

Commit

Permalink
Handle both old and new DB schemas.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ebag333 committed May 20, 2017
1 parent 9737631 commit e828eb4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions eos/db/migrations/upgrade6.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@


def upgrade(saveddata_engine):
saveddata_engine.execute('DELETE FROM damagePatterns WHERE name LIKE ? OR ID LIKE ?', ("Uniform", "1"))
saveddata_engine.execute('INSERT INTO damagePatterns VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
(1, "Uniform", 25, 25, 25, 25, None, None, None))
try:
saveddata_engine.execute('DELETE FROM damagePatterns WHERE name LIKE ? OR ID LIKE ?', ("Uniform", "1"))
saveddata_engine.execute('INSERT INTO damagePatterns VALUES (?, ?, ?, ?, ?, ?, ?)',
(1, "Uniform", 25, 25, 25, 25, None))
except:
# Most likely using the newer DB schema (migration 22). Go ahead and account for that.
saveddata_engine.execute('DELETE FROM damagePatterns WHERE name LIKE ? OR ID LIKE ?', ("Uniform", "1"))
saveddata_engine.execute('INSERT INTO damagePatterns VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
(1, "Uniform", 25, 25, 25, 25, None, None, None))

0 comments on commit e828eb4

Please sign in to comment.