Skip to content

check project database compatability and apply upgrades#20

Open
jthurner wants to merge 4 commits intodevelopfrom
project_upgrades
Open

check project database compatability and apply upgrades#20
jthurner wants to merge 4 commits intodevelopfrom
project_upgrades

Conversation

@jthurner
Copy link
Collaborator

Changes upgrade_project_to_latest_version() to immediately return if the project version is current, set the version property sequentially after each migration, and always run the upgrade function when a project is activated.

@jthurner jthurner requested a review from ascheidl February 24, 2023 14:15
Copy link
Contributor

@ascheidl ascheidl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ich glaube ein automatischers upgrade ist nicht gut ... zumindest für uns am IEE, weil das ggf bedeutet, dass Mitarbeiter mit älteren PH versionen plötzlich die Netzdaten nicht mehr laden können

@jthurner
Copy link
Collaborator Author

Wie wäre es hiermit:

Versuche ich das Projekt mit einer inkompatiblen ph version zu öffnen wird ein Fehler gelogged und das Projekt nicht aktiviert. Inkompatibel meint das eine neuere pandahub version migrationen am schema der projekt-db vorgenommen hat.

Öffne ich ein Projekt für das meine aktuelle pandahub version schema migrations vorsieht wird ein Fehler gelogged und das Projekt nicht aktiviert, außer ich übergebe "apply_upgrades=True" - dann werden alle außstehenden migrationen durchgeführt und das Projekt aktiviert.

Um die Implementation simpel zu halten wird in den project settings hier nicht die letzte pandahub version mit der das Projekt geöffnet wurde gespeichert sondern die letzte pandahub version die eine migration vorgenommen hat.

@jthurner jthurner requested a review from ascheidl February 28, 2023 10:09
@jthurner jthurner changed the title apply project upgrades sequentially check project database compatability and apply upgrades Feb 28, 2023
@ascheidl
Copy link
Contributor

ascheidl commented Mar 1, 2023

klingt sinnvoll für mich!

* immediately return if project version is up-to-date
* update project version sequentially after each migration
Projects are versioned with the latest pandahub release which included schema changes.

If the project had schema migrations from later pandahub versions applied, trying to activate it will log an error asking the user to update pandahub.

If the project database needs migrations in order to work with the current pandahub version, they will be
applied if activate_project() is called with apply_upgrades=True, otherwise the project is not activated and an error logged to the user.
@jthurner jthurner requested a review from dlohmeier April 28, 2023 11:39
@ascheidl
Copy link
Contributor

fine für mich

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants