diff --git a/backend/src/db/migrate/template.js b/backend/src/db/migrate/template.js index 1d63673b4..9adb0786d 100644 --- a/backend/src/db/migrate/template.js +++ b/backend/src/db/migrate/template.js @@ -18,6 +18,7 @@ export async function up(next) { await transaction.rollback() // eslint-disable-next-line no-console console.log('rolled back') + throw new Error(error) } finally { session.close() } diff --git a/backend/src/db/migrations/20200206190233-swap_latitude_with_longitude.js b/backend/src/db/migrations/20200206190233-swap_latitude_with_longitude.js index 381d6db1d..619e30320 100644 --- a/backend/src/db/migrations/20200206190233-swap_latitude_with_longitude.js +++ b/backend/src/db/migrations/20200206190233-swap_latitude_with_longitude.js @@ -1,7 +1,12 @@ import { getDriver } from '../../db/neo4j' -export const description = - 'This migration swaps the value stored in Location.lat with the value of Location.lng.' +export const description = ` +This migration swaps the value stored in Location.lat with the value +of Location.lng. This is necessary as the values of lat and lng were +stored incorrectly. For example Hamburg, Germany, was stored with the +values lat=10.0 and lng=53.55, which is close to the horn of Africa, +but it is lat=53.55 and lng=10.0 +` const swap = async function(next) { const driver = getDriver() @@ -11,8 +16,8 @@ const swap = async function(next) { // Implement your migration here. await transaction.run(` MATCH (l:Location) WHERE NOT(l.lat IS NULL) - WITH l.lng AS longitude, l.lat AS latitude, l AS Location - SET Location.lat = longitude, Location.lng = latitude + WITH l.lng AS longitude, l.lat AS latitude, l AS location + SET location.lat = longitude, location.lng = latitude `) await transaction.commit() next()