Hello. Lets say, i need to reset in-memory database before each test. Reset - delete all existed rows and add default ones. But the problem is that after I call
deleteAll()
the PK value is not reseted to 0. Is there a way to do it?
savrov
01/20/2020, 11:36 AM
Copy code
exec("ALTER SEQUENCE 'slots_id_seq' RESTART WITH 1")
return me an error:
Syntax error in SQL statement "ALTER SEQUENCE 'slots_id_seq'[*] RESTART WITH 1"; expected "identifier"
t
tapac
01/20/2020, 12:19 PM
What
in-memory
database do you use?
Maybe it's simplier allways recreate the whole database from the ground?
s
savrov
01/20/2020, 2:18 PM
damn, i forgot that im using h2 database for tests and tried to apply postgresql command on it.
for h2 its simple as:
Copy code
exec("ALTER TABLE slots ALTER COLUMN id RESTART WITH 1")