Fixes #2205 - runs conversions on modules.baseItemID since the creation of baseItemID. Also, centralized the function to convert modules so that in case we ever add other things that need to be converted, they are all in one spot.
This commit is contained in:
16
eos/db/migrations/upgrade40.py
Normal file
16
eos/db/migrations/upgrade40.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
Migration 40
|
||||
|
||||
Imports all item conversions since Migration 28 and runs them against module.baseItemID. This column seems to have been
|
||||
forgotten about since it's been added.
|
||||
|
||||
"""
|
||||
from. utils import convert_modules
|
||||
from .upgrade36 import CONVERSIONS as u36
|
||||
from .upgrade37 import CONVERSIONS as u37
|
||||
from .upgrade38 import CONVERSIONS as u38
|
||||
from .upgrade39 import CONVERSIONS as u39
|
||||
|
||||
def upgrade(saveddata_engine):
|
||||
for conversions in [u36, u37, u38, u39]:
|
||||
convert_modules(saveddata_engine, conversions)
|
||||
15
eos/db/migrations/utils.py
Normal file
15
eos/db/migrations/utils.py
Normal file
@@ -0,0 +1,15 @@
|
||||
def convert_modules(engine, conversions):
|
||||
'''Converts modules based on tiericide conversion mappings.
|
||||
|
||||
:param engine:
|
||||
:param conversions:
|
||||
:return:
|
||||
'''
|
||||
for replacement_item, list in conversions.items():
|
||||
for retired_item in list:
|
||||
engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
|
||||
(replacement_item, retired_item))
|
||||
engine.execute('UPDATE "modules" SET "baseItemID" = ? WHERE "baseItemID" = ?',
|
||||
(replacement_item, retired_item))
|
||||
engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?',
|
||||
(replacement_item, retired_item))
|
||||
Reference in New Issue
Block a user