Original link: https://www.mqllin.cn/archives/194.html
Recently, I encountered a problem. In the test case, the H2 database is used, and there is an auto-incrementing primary key in a table. The database will be cleared after each execution of the test case, but the auto-increment primary key is not reset, causing the primary key of subsequent new data to continue to increment instead of starting from 1. resulting in test cases interacting with each other
H2 database
You can use the following command to reset the primary key after the test case
“`
ALTER TABLE ALTER COLUMN RESTART WITH 1;
“`
This article is transferred from: https://www.mqllin.cn/archives/194.html
This site is only for collection, and the copyright belongs to the original author.