eliasdoehne / stellaris-dashboard

A graph dashboard and event log for Stellaris.
123 stars 14 forks source link

Show empire origin #149

Closed MichaelMakesGames closed 4 months ago

MichaelMakesGames commented 4 months ago

From Stellaris Modding Den Discord:

Request: for the origin to also be displayed with the other country info (civics, ethics, etc)

Technical Notes

The origin is not saved currently, so this will requiring edits to Country in datamodel.py and CountryProcessor.extract_data_from_gamestate in timeline.py.

For displaying the origin, we need to edit EventTemplateDictBuilding.country_details in history_ledger.py

MichaelMakesGames commented 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

eliasdoehne commented 4 months ago

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)

MichaelMakesGames commented 4 months ago

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

eliasdoehne commented 4 months ago

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.

MichaelMakesGames commented 4 months ago

I'll write a separate issue for that edit: here it is #151