Closed MichaelMakesGames closed 4 months ago
@eliasdoehne is there anything set up for database migrations? I looked but didn't see anything Otherwise this change causes errors when running on an existing DB; the user either needs to manually edit their SQLite DB, or entirely delete the DB
No, I never used migrations. Since there is a separate DB created for each game, I did not consider the database to be a long-term storage. I usually just mentioned in the release notes if a change is breaking the schema so people should finish their current game before upgrading. (often this also coincided with a new DLC/game release, which usually breaks save file compatibility anyway)
(I guess a workaround to this would be reparsing save files with the new release, but it's also not a great solution since Stellaris only keeps a few autosaves)
Thoughts on setting up alembic (part of the sqlalchemy project) to automatically migrate the DB?
I suspect schema changes will be needed to support things from the past several Stellaris releases, and it would be nice to be able to release those without breaking things
Sounds good! It would be useful to update the schemas in non-breaking releases. I'm not familiar with alembic, but at a glance it looks like a good fit.
I'll write a separate issue for that edit: here it is #151
From Stellaris Modding Den Discord:
Technical Notes
The origin is not saved currently, so this will requiring edits to
Country
indatamodel.py
andCountryProcessor.extract_data_from_gamestate
intimeline.py
.For displaying the origin, we need to edit
EventTemplateDictBuilding.country_details
inhistory_ledger.py