Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #168 +/- ##
============================================
+ Coverage 88.53% 88.99% +0.45%
+ Complexity 2325 2301 -24
============================================
Files 59 59
Lines 5749 5770 +21
============================================
+ Hits 5090 5135 +45
+ Misses 659 635 -24
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Add getLastInsertId(): int to the Connection base class with engine-specific implementations: - MySQLConnection: uses mysqli_insert_id() - MSSQLConnection: uses SELECT SCOPE_IDENTITY() - SQLiteConnection: already implemented Also adds Database::getLastInsertId() convenience method and refactors SchemaChangeRepository to use it instead of SELECT MAX(id). Closes #167
added 3 commits
June 13, 2026 04:05
The phpunit.xml uses PHPUnit 10.5 schema but PHP 8.1/8.2 workflows installed phpunit:9.5.20 globally, which can't parse the config. This caused clover.xml to never be generated, breaking coverage upload. Fix: use Composer-installed vendor/bin/phpunit across all workflows and remove global phpunit tool installations.
By default, release-please only includes feat and fix in the changelog. Adding "hidden": false to other types ensures ci, test, refactor, docs, and custom types are visible in release notes.
The test assumed both rows would have the same created_on timestamp, but when the insert crosses a second boundary they differ. Use each row's actual timestamp instead.
|
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.



Summary
Add an abstract
getLastInsertId(): intmethod to theConnectionbase class with engine-specific implementations, and expose it at theDatabaseclass level.Motivation
Repositories resorted to
SELECT MAX(id)queries which are susceptible to race conditions under concurrent inserts. Closes #167.Changes
abstract getLastInsertId(): inttoConnectionMySQLConnectionusingmysqli_insert_id()MSSQLConnectionusingSELECT SCOPE_IDENTITY()SQLiteConnectionalready had the implementationDatabase::getLastInsertId()convenience methodSchemaChangeRepositoryto use the new method instead ofSELECT MAX(id)Database::getLastInsertId()How to Test / Verify
Unit tests cover SQLite (run locally). MySQL/MSSQL tests require running database servers via CI.
php vendor/bin/phpunit -c tests/phpunit.xml --testsuite="SQLite Tests"Breaking Changes and Migration Steps
None. The only impact is on classes that extend
Connectiondirectly — they must now implementgetLastInsertId(): int.Checklist
composer fix-cs)Related issues
Closes #167