From ba57822d23de7fcd3a622128305757e7b1539dd7 Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Fri, 19 Feb 2021 11:27:29 +0100 Subject: [PATCH] fix: generate uuid in js migration instead of from db --- package.json | 1 + src/migrations/20210218090213-generate-server-identifier.js | 5 ++++- yarn.lock | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ebc990cafe..bb982fdb94 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,7 @@ "response-time": "^2.3.2", "serve-favicon": "^2.5.0", "unleash-frontend": "3.11.4", + "uuid": "^8.3.2", "yargs": "^16.0.3" }, "devDependencies": { diff --git a/src/migrations/20210218090213-generate-server-identifier.js b/src/migrations/20210218090213-generate-server-identifier.js index 30d42b4893..59096c2de0 100644 --- a/src/migrations/20210218090213-generate-server-identifier.js +++ b/src/migrations/20210218090213-generate-server-identifier.js @@ -1,9 +1,12 @@ 'use strict'; +const { v4 } = require('uuid'); + exports.up = function(db, cb) { + const instanceId = v4(); db.runSql( ` - INSERT INTO settings(name, content) VALUES ('instanceInfo', json_build_object('id', gen_random_uuid())); + INSERT INTO settings(name, content) VALUES ('instanceInfo', json_build_object('id', '${instanceId}')); `, cb, ); diff --git a/yarn.lock b/yarn.lock index 3ec540e310..210f3b00f0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6330,6 +6330,11 @@ uuid@^3.2.1, uuid@^3.3.2, uuid@^3.3.3: resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + v8-compile-cache@^2.0.3: version "2.1.1" resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz"