-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/generic db migration system #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Introduce abstract Migration class for defining database migrations - Require implementation of 'up' and 'down' methods for idempotent migrations - Include versioning, description, and optional GitHub PR reference for each migration - Facilitate chronological ordering and rollback capabilities in database schema management
…cture - Implement RefactorAdConfigToRoleBased migration - Transform adConfig structure in RemoteConfig documents - Replace old ad frequency fields with new visibleTo maps - Update FeedAdConfiguration, ArticleAdConfiguration, and InterstitialAdConfiguration - Ensure backward compatibility in down migration
- Introduce `allMigrations` list to store all database migration classes - Add initial migration for refactoring ad config to role-based system - Include necessary imports for migration functionality
- Add DatabaseMigrationService to manage and execute database migrations - Implement migration process: ensure migrations_history collection, fetch applied versions, sort migrations, apply pending migrations, record applied migrations - Use unique index on version field for idempotency and prevent redundant execution - Log migration process and handle failures
…cess - Add DatabaseMigrationService to handle database schema migrations - Include all_migrations.dart in the import list - Update AppDependencies to initialize and run database migrations - Modify the application startup process to apply migrations before seeding
- Correct typo in adConfig comment - Enhance log message for existing RemoteConfig - Clarify RemoteConfig setup process in comments
- Explain the new database migration system using a versioned approach - Highlight key features like idempotency and generic model support - Describe the date-time based naming convention for migrations - Emphasize the benefits of automated schema evolution for deployments
- Replace 'version' with 'prDate' to reflect the merge date of the PR - Rename 'description' to 'prSummary' for consistency - Add 'prId' as a required field for unique PR identification - Update documentation to reflect new fields and their purpose
- Update RefactorAdConfigToRoleBased migration class constructor parameters - Improve log message in up() method to include PR ID and date
- Clarify the process for adding new migration classes - Update explanation of how migrations are sorted and applied
- Migrate from version-based to PR date-based identification - Update collection name to 'pr_migrations_history' - Modify migration sorting and checking mechanism - Enhance logging and recording of migration details
- Change "Versioned Schema Evolution" to "PR-Driven Schema Evolution" - Update migration naming to use Pull Request merge date, summary, and ID - Add traceability with links to originating code changes - Improve clarity and emphasis on saying goodbye to manual updates
Summary of ChangesHello @fulleni, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request implements a comprehensive, generic database migration system for MongoDB. This system automates schema evolution on application startup, ensuring data consistency and providing clear traceability by linking each migration to its originating GitHub Pull Request. The initial migration demonstrates this capability by refactoring the ad configuration within Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a well-designed and robust database migration system. The implementation is clean, follows best practices like idempotency, and is nicely integrated into the application's startup sequence. The use of PR metadata for versioning is a clever approach for traceability. I have a few suggestions to further improve maintainability and robustness, but overall, this is an excellent addition to the project.
lib/src/database/migrations/20250924084800__refactor_ad_config_to_role_based.dart
Show resolved
Hide resolved
- Remove comment_references lint ignore - Update migration documentation to use prDate and prSummary instead of version and description
- Create a copy of _migrations list before sorting - Ensures chronological application of migrations based on prDate
Status
READY
Description
This pull request implements a comprehensive, generic database migration system for MongoDB. This system automates schema evolution on application startup, ensuring data consistency and providing clear traceability by linking each migration to its originating GitHub Pull Request. The initial migration demonstrates this capability by refactoring the ad configuration within RemoteConfig documents to a more flexible, role-based structure.
Type of Change