Closed Kh-Oleg closed 1 year ago
I'm afraid this would be difficult to do.
The database was not really "corrupted", it's just that a migration occurred and now is in a more modern state which is not compatible with older versions.
The alternative way would be to implement a specific CLI to downgrade migrations, but this would be quite complex to test and maintain
Isn't possible to perform the whole startup db modifications (migration, minor changes, etc.) as a transaction, which is committed when Fief understands that it has started successfully and can serve requests, and rolls back in any other case?
Maybe, we would need to tinker with Alembic for this. Even with this, it wouldn't help with MySQL which apparently can't rollback transactions with CREATE/ALTER TABLE.
Got it, the issue can be closed.
Describe the bug
Related to https://github.com/fief-dev/fief/issues/206 After downgrade back to 0.24.2, which was running before, I get "CommandError: Can't locate revision identified by 'deb3261a9742'"
To Reproduce
Steps to reproduce the behavior: After unsuccessful attempt to upgrade to 0.25.1, I wanted to come back to the version 0.24.2, which was used before.
The Fief 0.24.2 does not start
Expected behavior
Fief shall not leave database in a corrupted state. If it writes something to db upon startup, these changes shall be committed only when startup was successful and rolled back to the initial state otherwise.
Configuration
Additional context
See the log of 0.24.2 after downgrade from 0.25.1 2023_06_02_fief-0.24.2.log