Skip to content

Commit d1345fc

Browse files
committed
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.
1 parent 31cae0e commit d1345fc

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

eos/db/migrations/upgrade40.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
Migration 40
3+
4+
Imports all item conversions since Migration 28 and runs them against module.baseItemID. This column seems to have been
5+
forgotten about since it's been added.
6+
7+
"""
8+
from. utils import convert_modules
9+
from .upgrade36 import CONVERSIONS as u36
10+
from .upgrade37 import CONVERSIONS as u37
11+
from .upgrade38 import CONVERSIONS as u38
12+
from .upgrade39 import CONVERSIONS as u39
13+
14+
def upgrade(saveddata_engine):
15+
for conversions in [u36, u37, u38, u39]:
16+
convert_modules(saveddata_engine, conversions)

eos/db/migrations/utils.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def convert_modules(engine, conversions):
2+
'''Converts modules based on tiericide conversion mappings.
3+
4+
:param engine:
5+
:param conversions:
6+
:return:
7+
'''
8+
for replacement_item, list in conversions.items():
9+
for retired_item in list:
10+
engine.execute('UPDATE "modules" SET "itemID" = ? WHERE "itemID" = ?',
11+
(replacement_item, retired_item))
12+
engine.execute('UPDATE "modules" SET "baseItemID" = ? WHERE "baseItemID" = ?',
13+
(replacement_item, retired_item))
14+
engine.execute('UPDATE "cargo" SET "itemID" = ? WHERE "itemID" = ?',
15+
(replacement_item, retired_item))

0 commit comments

Comments
 (0)