Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

Commit

Permalink
Merge pull request #331 from Financial-Times/neo4j-v4
Browse files Browse the repository at this point in the history
upgraded neo4j db and driver
  • Loading branch information
GeoffThorpeFT authored Feb 5, 2021
2 parents 6196d70 + ecea9b1 commit 2cc5a38
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ references:
TERM: xterm

environment:
NEO4J_VERSION: '3.5.0'
NEO4J_VERSION: '4.1.6'

workspace_root: &workspace_root ~/

Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ node_modules/@financial-times/rel-engage/index.mk:

# End generated by rel-engage
# ---------------------------
LOCAL_BOLT_URL=bolt://localhost:7687
LOCAL_BOLT_URL=neo4j://localhost:7687
BIZ_OPS_BOLT_URL=${NEO4J_BOLT_URL}
NEO4J_VERSION=3.5.0
NEO4J_VERSION=4.1.6
PRODUCT_NAME=biz-ops
PROJECT_NAME=biz-ops-api

Expand Down Expand Up @@ -100,6 +100,7 @@ run-test-db:
wget -q dist.neo4j.org/neo4j-community-$(NEO4J_VERSION)-unix.tar.gz; \
tar -xzf neo4j-community-$(NEO4J_VERSION)-unix.tar.gz -C neo4j --strip-components 1; \
sed -i "s|#dbms.security.auth_enabled=false|dbms.security.auth_enabled=false|g" neo4j/conf/neo4j.conf;\
cat neo4j/conf/neo4j.conf;\
./scripts/neo4j-plugins; \
dbms_memory_heap_initial_size="1024m" dbms_memory_heap_max_size="1024m" neo4j/bin/neo4j start; \
./scripts/neo4j-wait-for-start;
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: '3'
services:
neo4j:
image: neo4j:3.5.0
image: neo4j:4.1.6
environment:
- NEO4J_dbms_logs_query_enabled=true
- NEO4J_dbms_logs_query_enabled=VERBOSE
- NEO4J_AUTH=none
- NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
- NEO4J_db_temporal_timezone=Z
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"http-errors": "^1.7.3",
"lodash": "^4.17.18",
"module-alias": "^2.2.2",
"neo4j-driver": "^1.7.7",
"neo4j-driver": "^4.1.2",
"node-fetch": "^2.6.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/tc-api-db-manager/db-connection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const neo4j = require('neo4j-driver').v1;
const neo4j = require('neo4j-driver');
const metrics = require('next-metrics');
const { logger } = require('@financial-times/tc-api-express-logger');

Expand Down
6 changes: 2 additions & 4 deletions packages/tc-api-db-manager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ const initConstraints = async () => {
const retrieveConstraints = async () => {
const constraints = await executeQuery('CALL db.constraints');
return constraints.records.map(constraint =>
constraint.get('description'),
constraint.get('name'),
);
};

const retrieveIndexes = async () => {
const indexes = await executeQuery('CALL db.indexes');
return indexes.records.map(constraint =>
constraint.get('description'),
);
return indexes.records.map(constraint => constraint.get('name'));
};

const existingConstraints = await retrieveConstraints();
Expand Down
2 changes: 1 addition & 1 deletion packages/tc-api-db-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@financial-times/n-logger": "^6.1.0",
"@financial-times/tc-api-express-logger": "file:../tc-api-express-logger",
"@financial-times/tc-schema-sdk": "file:../tc-schema-sdk",
"neo4j-driver": "^1.7.7",
"neo4j-driver": "^4.1.2",
"next-metrics": "^3.1.22"
},
"repository": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const neo4jTemporalTypes = require('neo4j-driver/lib/v1/temporal-types');
const neo4jTemporalTypes = require('neo4j-driver/lib/temporal-types');
const { setupMocks, neo4jTest } = require('../../../test-helpers');
const { dbUnavailable } = require('../../../test-helpers/error-stubs');
const { spyDbQuery } = require('../../../test-helpers/db-spies');
Expand Down
2 changes: 1 addition & 1 deletion packages/tc-api-rest-handlers/lib/diff-properties.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const neo4jTemporalTypes = require('neo4j-driver/lib/v1/temporal-types');
const neo4jTemporalTypes = require('neo4j-driver/lib/temporal-types');
const { getType } = require('@financial-times/tc-schema-sdk');

const isNullValue = val => val === null || val === '';
Expand Down
4 changes: 2 additions & 2 deletions packages/tc-api-rest-handlers/lib/neo4j-type-conversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const {
isDateTime,
isDate,
isTime,
} = require('neo4j-driver/lib/v1/temporal-types');
const neo4jTemporalTypes = require('neo4j-driver/lib/v1/temporal-types');
} = require('neo4j-driver/lib/temporal-types');
const neo4jTemporalTypes = require('neo4j-driver/lib/temporal-types');
const { getType } = require('@financial-times/tc-schema-sdk');

const entriesToObject = (map, [key, val]) => Object.assign(map, { [key]: val });
Expand Down
2 changes: 1 addition & 1 deletion packages/tc-api-rest-handlers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"http-errors": "^1.7.3",
"lodash.isempty": "^4.4.0",
"lodash.groupby": "^4.6.0",
"neo4j-driver": "^1.7.6"
"neo4j-driver": "^4.1.2"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/tc-schema-sdk/data-accessors/graphql-defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const addStaticDefinitions = composer => {
};

const addEnumDefinitions = (composer, sdk) => {
Object.entries(sdk.getEnums({ withMeta: true })).map(
Object.entries(sdk.getEnums({ withMeta: true })).forEach(
([name, { description: enumDescription, options }]) => {
const values = {};
Object.values(options).forEach(
Expand Down
4 changes: 2 additions & 2 deletions scripts/neo4j-plugins
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

mkdir -p neo4j/{plugins,logs,data}

APOC_PLUGIN_URL=https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.5.0.1/apoc-3.5.0.1-all.jar
APOC_PLUGIN_FILENAME=neo4j/plugins/apoc-3.5.0.1-all.jar
APOC_PLUGIN_URL=https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/4.1.0.4/apoc-4.1.0.4-all.jar
APOC_PLUGIN_FILENAME=neo4j/plugins/apoc-4.1.0.4-all.jar

if type wget 2>/dev/null; then
wget -O $APOC_PLUGIN_FILENAME $APOC_PLUGIN_URL
Expand Down
2 changes: 1 addition & 1 deletion test-helpers/db-connection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const neo4j = require('neo4j-driver').v1;
const neo4j = require('neo4j-driver');

const driver = neo4j.driver(
process.env.NEO4J_BOLT_URL || 'bolt://localhost:7687',
Expand Down
2 changes: 1 addition & 1 deletion test-helpers/test-fixtures.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { DateTime } = require('neo4j-driver/lib/v1/temporal-types.js');
const { DateTime } = require('neo4j-driver/lib/temporal-types.js');

const { driver } = require('./db-connection');

Expand Down

0 comments on commit 2cc5a38

Please sign in to comment.