mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Favor transaction functions even for seeds
This commit is contained in:
parent
53791c83e8
commit
6903a6cc71
@ -29,10 +29,16 @@ const factories = {
|
|||||||
|
|
||||||
export const cleanDatabase = async (options = {}) => {
|
export const cleanDatabase = async (options = {}) => {
|
||||||
const { driver = getDriver() } = options
|
const { driver = getDriver() } = options
|
||||||
const cypher = 'MATCH (n) DETACH DELETE n'
|
|
||||||
const session = driver.session()
|
const session = driver.session()
|
||||||
try {
|
try {
|
||||||
return await session.run(cypher)
|
await session.writeTransaction(transaction => {
|
||||||
|
return transaction.run(
|
||||||
|
`
|
||||||
|
MATCH (everything)
|
||||||
|
DETACH DELETE everything
|
||||||
|
`,
|
||||||
|
)
|
||||||
|
})
|
||||||
} finally {
|
} finally {
|
||||||
session.close()
|
session.close()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user