File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
src/lib/Persistence/Legacy/SharedGateway/DatabasePlatform Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ final class SqliteGateway implements Gateway
1818 */
1919 private const FATAL_ERROR_CODE = 7 ;
2020
21+ private const DB_INT_MAX = 2147483647 ;
22+
2123 /** @var array<string, int> */
2224 private $ lastInsertedIds = [];
2325
@@ -27,7 +29,7 @@ public function getColumnNextIntegerValue(
2729 string $ sequenceName
2830 ): ?int {
2931 $ lastId = $ this ->lastInsertedIds [$ sequenceName ] ?? 0 ;
30- $ nextId = (int )hrtime (true );
32+ $ nextId = (int )hrtime (true ) % self :: DB_INT_MAX ;
3133
3234 // $lastId === $nextId shouldn't happen using high-resolution time, but better safe than sorry
3335 return $ this ->lastInsertedIds [$ sequenceName ] = $ lastId === $ nextId ? $ nextId + 1 : $ nextId ;
You can’t perform that action at this time.
0 commit comments