Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
Seeder is slow and inefficient because
Seeder.hasDataChangesretrieve all data from database and compare it with the data from package.What is the new behavior?
This pull request includes significant changes to the seeder logic and database schema across multiple database systems. The most important changes include the addition of a new
SeederLogsmodel, refactoring of the seeder methods to simplify the code, and the introduction of a utility function to get the installed package version.Now
hasDataChangedis determined by the version of installedidn-area-datapackage and the latest version of saved data in database (in theSeederLogs).Database schema updates:
SeederLogsmodel to the schemas for MongoDB, MySQL, PostgreSQL, and SQLite. This model includes fields forid,dataVersion, andcreatedAtto track seeder execution logs. [1] [2] [3] [4]Seeder refactoring:
MongodbSeederclass to remove redundant methods for checking data changes and deleting collections. Introduced a genericdeleteAreasmethod to handle deletion for all area types.deleteAreasandinsertAreasmethods, streamlining the deletion and insertion processes.Utility function:
getInstalledPackageVersionto obtain the version of an installed package usingpnpm list --json. This function is used in the seeder to compare the installed package version with the latest data version in the database.Testing:
getInstalledPackageVersionfunction to verify its behavior under different scenarios, such as when the package is found, not found, or an error occurs.Other information
You need to run
db:migrateanddb:seedto apply this changes.