feat: [#358] Implement Sqlite Mysql drivers#950
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #950 +/- ##
=======================================
Coverage 69.15% 69.15%
=======================================
Files 157 157
Lines 10526 10526
=======================================
Hits 7279 7279
Misses 2913 2913
Partials 334 334 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
PR Overview
This PR implements new SQLite/MySQL driver methods and updates the test suite to ensure proper functionality and cleanup. Key changes include:
- Adding new methods to the Schema and Blueprint interfaces and their corresponding mocks.
- Updating dependency imports and adding a new decode hook (ToStringHookFunc) for proper MySQL string conversion.
- Enabling and refactoring several test cases (e.g. InsertGetId, LockForUpdate, DB connection tests) for improved coverage and reliability.
Reviewed Changes
| File | Description |
|---|---|
| mocks/database/driver/Schema.go | Added GetColumns/GetIndexes/Orm methods and associated mock helpers. |
| mocks/database/driver/Blueprint.go | Added GetCommands method for Blueprint mocks. |
| tests/db_test.go | Updated test cases and Docker shutdown handling for SQLite. |
| database/db/row.go | Updated dependency import and added ToStringHookFunc for MySQL support. |
| tests/query_test.go | Enabled previously commented-out tests and refined test logic. |
| contracts/database/driver/grammar.go | Enhanced Schema and Blueprint interfaces with new methods. |
| database/db/query.go | Simplified the Chunk method by appending rows directly. |
| tests/migrator_test.go | Un-commented and updated SQLServer migration tests. |
| tests/orm_test.go | Updated tear down logic for SQLite Docker shutdown. |
| tests/query.go | Un-commented MySQL/SQLite related code in TestQueryBuilder and mix functions. |
| tests/repository_test.go | Updated Docker shutdown handling in repository tests. |
| tests/mock_config.go | Updated mock configuration expectations for database connections. |
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
almas-x
pushed a commit
that referenced
this pull request
Mar 12, 2025
almas-x
pushed a commit
that referenced
this pull request
Mar 18, 2025
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.
📑 Description
goravel/goravel#358
This pull request includes several changes to the database driver and tests. The most important changes include adding new methods to the
SchemaandBlueprintinterfaces, updating dependencies, and modifying test cases to ensure proper functionality and cleanup.Interface Enhancements:
GetColumns,GetIndexes, andOrmmethods to theSchemainterface incontracts/database/driver/grammar.go.GetCommandsmethod to theBlueprintinterface incontracts/database/driver/grammar.go.Dependency Updates:
mapstructureimport indatabase/db/row.goto usegithub.com/go-viper/mapstructure/v2.tests/go.modsuch asgithub.com/goravel/mysql,github.com/goravel/sqlite, and others. [1] [2] [3] [4]Test Modifications:
tests/db_test.goto ensure proper functionality of database operations. [1] [2] [3]SetupTestandTearDownSuitemethods intests/db_test.goandtests/migrator_test.goto handle Docker shutdown for SQLite. [1] [2]Code Simplification:
Chunkmethod indatabase/db/query.goby directly appending rows to the destination slice.Mock Enhancements:
GetColumns,GetIndexes, andOrmmethods inmocks/database/driver/Schema.go.These changes collectively improve the functionality, maintainability, and test coverage of the database driver and related components.
✅ Checks