Hello. Lets say, i need to reset in-memory databas...
# exposed
s
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?
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
What
in-memory
database do you use? Maybe it's simplier allways recreate the whole database from the ground?
s
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")
😂 1