mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-20 20:01:25 +00:00
Add back missing search constraint
This commit is contained in:
parent
ce664040c6
commit
98a4521ecc
@ -3,10 +3,27 @@ import { getDriver, getNeode } from '../../db/neo4j'
|
||||
class Store {
|
||||
async init(fn) {
|
||||
const neode = getNeode()
|
||||
await getNeode().schema.install()
|
||||
const { driver } = neode
|
||||
const session = driver.session()
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Successfully created database indices and constraints!')
|
||||
neode.driver.close()
|
||||
const writeTxResultPromise = session.writeTransaction(async txc => {
|
||||
await txc.run('CALL apoc.schema.assert({},{},true)') // drop all indices
|
||||
return Promise.all([
|
||||
'CALL db.index.fulltext.createNodeIndex("post_fulltext_search",["Post"],["title", "content"])',
|
||||
'CALL db.index.fulltext.createNodeIndex("user_fulltext_search",["User"],["name", "slug"])'
|
||||
].map(statement => txc.run(statement)))
|
||||
})
|
||||
try {
|
||||
await writeTxResultPromise
|
||||
await getNeode().schema.install()
|
||||
console.log('Successfully created database indices and constraints!')
|
||||
} catch (error) {
|
||||
console.log(error) // eslint-disable-line no-console
|
||||
} finally {
|
||||
session.close()
|
||||
driver.close()
|
||||
fn()
|
||||
}
|
||||
}
|
||||
|
||||
async load(fn) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user