Needs work
Project:
Drupal core
Version:
main
Component:
database system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Aug 2026 at 16:15 UTC
Updated:
14 Sep 2026 at 07:55 UTC
Jump to comment: Most recent
In #1411074: Allow kernel tests to share the test environment we are working on resetting the database whenever a new test method is executed. This requires, among other things, to reset serial IDs, which requires a different logic for each DB driver.
Add a new DB connection method to reset serial IDs.
None, only additions.
TBD
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
plachComment #4
plachComment #5
daffie commentedThis is to me not a feature request, but just a plain bug. When I truncate a table, I would expect that the value of the primary key would start at 1 again. No new method is needed, just a bugfix and testing.
Comment #6
plachThanks for the feedback! I'm a bit concerned about BC: if this wasn't reported before, couldn't people be relying on the current non-MySQL behaviors?
Comment #7
plachMaybe a change record would be enough, if we only merge this in D12.
Comment #8
daffie commentedDuring the running of a site in production, you will not be calling Connection::truncate() on any table. It is a special operation. And yes, any bug on which code is relaying on to be there, will result in a BC break when you fix the bug. That has not stopped us fixing other bugs. Maybe we can add an option to get the original functionality back, but it default value should be to reset the serial id. We should add a CR for this bug fix.
Comment #9
plachPushed an update resetting serial IDs by default, unless within a transaction or reset skipped explicitly.
Comment #10
plachComment #13
ironnuts commentedRe: #8 and #9, #8 states:
plach, you state at #9 that your commit resets serial ID's by default. So we need a CR, right?
Comment #14
plachI'd say we do need a CR anyway, because we are adding a new option. There we can mention the behavior change, to ensure it's not missed.
Comment #15
plachWe also need an issue summary update, but I'd like to get some feedback on the MR before working on those.
Comment #16
ironnuts commentedRe: #15 Grazie. Comprendo.
Comment #17
daffie commentedI have a single remark on the PR.
The gitlab CI pipeline also needs to run for all the supported databases (MySQL, MariaDB, PostgreSQL and SQLite).