Repository navigation
fix: Prune trailing empty migration dirs (#3985) - #5044
marcelomendoncasoares merged 4 commits into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Thank you for your contribution with this fix, @Moe1211! And sorry for the long delay on the review, we have been heads down on a big release in the past month.
Your approach is very good! It fixes the issue with negligible performance penalty - given that we just check the trailing directory and abort on the first found file. I made only a few suggestions to reduce code duplication and make the tests more adherent to the pattern.
I know it has been a while since you opened the PR, so please signal if you do not intend to work on it anymore - in which case we'll get it ready for merge.
c025b87 to
efe35e3
Compare
3bc067b
into
serverpod:main
When the newest migration version directory exists but is completely empty (common after discarding generated files),
create-migrationused to treat that as a corrupted migration and fail when readingdefinition_project.json.This PR aligns behavior with issue #3985:
FileSystemMigrationArtifactStore.listVersions(servermigrations/): from the end of the sorted version list, remove directories that contain no files or subdirectories. Stop as soon as a non-empty directory is found, so a folder that still has files but is missing real migration artifacts continues to surface the existing “missing artifact” / corrupted path.migration_registry.txtalready exists, rewrite it so it matches the remaining versions.ClientMigrationArtifactStore.listVersionsapplies the same rule underlib/migrations/and refreshesmigration_registry.dartwhen pruning occurred and that file exists (sopartdirectives do not point at removed folders).packages/serverpod_database/test/migration_artifacts_store/file_system_migration_artifact_store_test.dartand an extra case intools/serverpod_cli/test/integration/migrations/client_migration_artifact_store_test.dart.Fixes: #3985
Pre-launch Checklist
///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.Breaking changes
None.