mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-02-06 09:55:50 +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 {
|
class Store {
|
||||||
async init(fn) {
|
async init(fn) {
|
||||||
const neode = getNeode()
|
const neode = getNeode()
|
||||||
await getNeode().schema.install()
|
const { driver } = neode
|
||||||
|
const session = driver.session()
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log('Successfully created database indices and constraints!')
|
const writeTxResultPromise = session.writeTransaction(async txc => {
|
||||||
neode.driver.close()
|
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) {
|
async load(fn) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user