Skip to content

Commit

Permalink
added support for neo4j v5 (deprecation of db.constraints()
Browse files Browse the repository at this point in the history
  • Loading branch information
dekelpaz committed Mar 26, 2023
1 parent 16a45d5 commit d39f0ca
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bluehound",
"productName": "BlueHound",
"version": "1.1.0",
"version": "1.1.1",
"description": "BlueHound",
"neo4jDesktop": {
"apiVersion": "^1.2.0"
Expand Down
15 changes: 13 additions & 2 deletions src/chart/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,13 @@ async function deleteNodes() {
async function dropConstraints() {
let session = driver.session();
let constraints = [];
let result = await session.run('CALL db.constraints')
let result = [];

if (neoVersion.startsWith('4.3') || neoVersion.startsWith('4.4') || neoVersion.split(".", 1)[0] >= 5) {
result = await session.run('SHOW CONSTRAINTS')
} else {
result = await session.run('CALL db.constraints')
}

for (let record of result.records){
let constraint = record.get(0)
Expand All @@ -185,8 +191,13 @@ async function dropConstraints() {
async function dropIndexes() {
let session = driver.session();
let indexes = [];
let result = [];

let result = await session.run('CALL db.constraints')
if (neoVersion.startsWith('4.3') || neoVersion.startsWith('4.4') || neoVersion.split(".", 1)[0] >= 5) {
result = await session.run('SHOW CONSTRAINTS')
} else {
result = await session.run('CALL db.constraints')
}

for (let record of result.records){
let constraint = record.get(0)
Expand Down
15 changes: 13 additions & 2 deletions src/collectors/BloodHoundUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,13 @@ async function deleteNodes(event) {
async function dropConstraints(event) {
let session = driver.session();
let constraints = [];
let result = await session.run('CALL db.constraints')
let result = [];

if (neoVersion.startsWith('4.3') || neoVersion.startsWith('4.4') || neoVersion.split(".", 1)[0] >= 5) {
result = await session.run('SHOW CONSTRAINTS')
} else {
result = await session.run('CALL db.constraints')
}

for (let record of result.records){
let constraint = record.get(0)
Expand All @@ -343,8 +349,13 @@ async function dropConstraints(event) {
async function dropIndexes(event) {
let session = driver.session();
let indexes = [];
let result = [];

let result = await session.run('CALL db.constraints')
if (neoVersion.startsWith('4.3') || neoVersion.startsWith('4.4') || neoVersion.split(".", 1)[0] >= 5) {
result = await session.run('SHOW CONSTRAINTS')
} else {
result = await session.run('CALL db.constraints')
}

for (let record of result.records){
let constraint = record.get(0)
Expand Down
2 changes: 1 addition & 1 deletion src/modal/AboutModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {applicationGetDebugState} from "../application/ApplicationSelectors";
import JSZip from 'jszip';
import FileSaver from 'file-saver';

const version = "1.1.0";
const version = "1.1.1";

if (window.electron != undefined) {
window.electron.receive("console-messages", (consoleData) => {
Expand Down

0 comments on commit d39f0ca

Please sign in to comment.