@opengis/fastify-table 1.0.96 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/.eslintrc.cjs +42 -42
  2. package/Changelog.md +4 -0
  3. package/README.md +26 -26
  4. package/config.js +10 -10
  5. package/cron/controllers/cronApi.js +22 -22
  6. package/cron/controllers/utils/cronList.js +1 -1
  7. package/cron/funcs/addCron.js +131 -131
  8. package/cron/index.js +10 -10
  9. package/crud/controllers/utils/checkXSS.js +45 -45
  10. package/crud/controllers/utils/xssInjection.js +72 -72
  11. package/crud/funcs/dataUpdate.js +30 -30
  12. package/crud/funcs/getToken.js +27 -27
  13. package/crud/funcs/isFileExists.js +13 -13
  14. package/crud/funcs/setToken.js +53 -53
  15. package/crud/funcs/utils/logChanges.js +7 -4
  16. package/migration/exec.migrations.js +79 -76
  17. package/notification/controllers/testEmail.js +49 -49
  18. package/notification/funcs/utils/sendEmail.js +39 -39
  19. package/notification/index.js +38 -38
  20. package/package.json +1 -1
  21. package/pg/funcs/getPG.js +30 -30
  22. package/redis/funcs/getRedis.js +23 -23
  23. package/server/migrations/crm.sql +150 -150
  24. package/server/migrations/log.sql +80 -80
  25. package/server/migrations/properties.sql +31 -0
  26. package/server/migrations/roles.sql +164 -0
  27. package/server/migrations/users.sql +89 -0
  28. package/server/templates/select/test.storage.data.json +3 -3
  29. package/server/templates/select/test.suggest.ato_new.json +2 -2
  30. package/server/templates/select/test.suggest.ato_new.sql +25 -25
  31. package/server/templates/select/test.suggest.data.json +4 -4
  32. package/server/templates/select/test.suggest.parent.sql +2 -2
  33. package/server.js +14 -14
  34. package/table/controllers/card.js +44 -44
  35. package/table/controllers/filter.js +37 -37
  36. package/table/controllers/form.js +28 -28
  37. package/table/controllers/search.js +80 -72
  38. package/table/controllers/utils/getSelect.js +20 -20
  39. package/table/controllers/utils/getTemplate.js +69 -28
  40. package/table/controllers/utils/getTemplatePath.js +40 -0
  41. package/table/controllers/utils/getTemplate_old.js +28 -0
  42. package/table/controllers/utils/getTemplates.js +18 -18
  43. package/table/controllers/utils/loadTemplate.js +1 -0
  44. package/table/controllers/utils/loadTemplatePath.js +1 -0
  45. package/table/funcs/getFilterSQL/util/getCustomQuery.js +1 -1
  46. package/table/index.js +84 -80
  47. package/test/api/crud.xss.test.js +72 -72
  48. package/test/api/notification.test.js +37 -37
  49. package/test/api/suggest.test.js +65 -65
  50. package/test/config.example +18 -18
  51. package/test/funcs/notification.test.js +31 -31
  52. package/test/funcs/pg.test.js +34 -34
  53. package/test/funcs/redis.test.js +19 -19
  54. package/test/templates/cls/test.json +9 -9
  55. package/test/templates/form/cp_building.form.json +32 -32
  56. package/test/templates/select/account_id.json +3 -3
  57. package/test/templates/select/storage.data.json +2 -2
  58. package/test/templates/table/gis.dataset.table.json +20 -20
  59. package/util/controllers/logger.file.js +90 -90
  60. package/util/controllers/next.id.js +4 -4
  61. package/util/controllers/properties.get.js +19 -19
  62. package/util/controllers/utils/checkUserAccess.js +19 -19
  63. package/util/controllers/utils/getRootDir.js +20 -20
  64. package/util/index.js +23 -23
  65. package/utils.js +8 -0
@@ -1,72 +1,72 @@
1
- const xssInjection = [
2
- 'onkeypress=',
3
- 'onkeyup=',
4
- 'ondblclick=',
5
- 'onerror=',
6
- 'onmouseover=',
7
- '<meta',
8
- '<script',
9
- 'vascript:',
10
- 'onkeydown=',
11
- 'onmousedown=',
12
- 'onmouseenter=',
13
- 'onmouseleave=',
14
- 'onmousemove=',
15
- 'onmouseout=',
16
- 'onmouseup=',
17
- 'onmousewheel=',
18
- 'onpaste=',
19
- 'onscroll=',
20
- 'onwheel=',
21
- 'javascript:',
22
- '\\x',
23
- 'eval(',
24
- 'onmouseover=',
25
- 'action=',
26
- 'xlink:',
27
- 'allowscriptaccess',
28
- 'href=',
29
- 'behavior:',
30
- 'onreadystatechange=',
31
- 'onstart=',
32
- 'offline=',
33
- 'onabort=',
34
- 'onafterprint=',
35
- 'onbeforeonload=',
36
- 'onbeforeprint=',
37
- 'onblur=',
38
- 'oncanplay=',
39
- 'oncanplaythrough=',
40
- 'onchange=',
41
- 'onclick=',
42
- 'oncontextmenu=',
43
- 'ondblclick=',
44
- 'ondrag=',
45
- 'ondragend=',
46
- 'ondragenter=',
47
- 'ondragleave=',
48
- 'ondragover=',
49
- 'ondragstart=',
50
- 'ondrop=',
51
- 'ondurationchange=',
52
- 'onemptied=',
53
- 'onended=',
54
- 'onerror=',
55
- 'onfocus=',
56
- 'onformchange=',
57
- 'onforminput=',
58
- 'onhaschange=',
59
- 'oninput=',
60
- 'oninvalid=',
61
- 'onkeydown=',
62
- 'onkeypress=',
63
- 'onkeyup=',
64
- 'onload=',
65
- 'onloadeddata=',
66
- 'onloadedmetadata=',
67
- 'onloadstart=',
68
- 'alert(',
69
- 'script:',
70
- ];
71
-
72
- export default xssInjection;
1
+ const xssInjection = [
2
+ 'onkeypress=',
3
+ 'onkeyup=',
4
+ 'ondblclick=',
5
+ 'onerror=',
6
+ 'onmouseover=',
7
+ '<meta',
8
+ '<script',
9
+ 'vascript:',
10
+ 'onkeydown=',
11
+ 'onmousedown=',
12
+ 'onmouseenter=',
13
+ 'onmouseleave=',
14
+ 'onmousemove=',
15
+ 'onmouseout=',
16
+ 'onmouseup=',
17
+ 'onmousewheel=',
18
+ 'onpaste=',
19
+ 'onscroll=',
20
+ 'onwheel=',
21
+ 'javascript:',
22
+ '\\x',
23
+ 'eval(',
24
+ 'onmouseover=',
25
+ 'action=',
26
+ 'xlink:',
27
+ 'allowscriptaccess',
28
+ 'href=',
29
+ 'behavior:',
30
+ 'onreadystatechange=',
31
+ 'onstart=',
32
+ 'offline=',
33
+ 'onabort=',
34
+ 'onafterprint=',
35
+ 'onbeforeonload=',
36
+ 'onbeforeprint=',
37
+ 'onblur=',
38
+ 'oncanplay=',
39
+ 'oncanplaythrough=',
40
+ 'onchange=',
41
+ 'onclick=',
42
+ 'oncontextmenu=',
43
+ 'ondblclick=',
44
+ 'ondrag=',
45
+ 'ondragend=',
46
+ 'ondragenter=',
47
+ 'ondragleave=',
48
+ 'ondragover=',
49
+ 'ondragstart=',
50
+ 'ondrop=',
51
+ 'ondurationchange=',
52
+ 'onemptied=',
53
+ 'onended=',
54
+ 'onerror=',
55
+ 'onfocus=',
56
+ 'onformchange=',
57
+ 'onforminput=',
58
+ 'onhaschange=',
59
+ 'oninput=',
60
+ 'oninvalid=',
61
+ 'onkeydown=',
62
+ 'onkeypress=',
63
+ 'onkeyup=',
64
+ 'onload=',
65
+ 'onloadeddata=',
66
+ 'onloadedmetadata=',
67
+ 'onloadstart=',
68
+ 'alert(',
69
+ 'script:',
70
+ ];
71
+
72
+ export default xssInjection;
@@ -1,30 +1,30 @@
1
- import getPG from '../../pg/funcs/getPG.js';
2
-
3
- import getMeta from '../../pg/funcs/getMeta.js';
4
- import logChanges from './utils/logChanges.js';
5
-
6
- export default async function dataUpdate({
7
- table, id, data, pg: pg1, uid,
8
- }) {
9
- if (!data || !table || !id) return null;
10
-
11
- const pg = pg1 || getPG({ name: 'client' });
12
- const { columns, pk } = await getMeta(table);
13
-
14
- const names = columns?.map((el) => el.name);
15
- const filterData = Object.keys(data)
16
- .filter((el) => (/* typeof data[el] === 'boolean' ? true : data[el] && */ names?.includes(el)));
17
-
18
- const filterValue = filterData.map((el) => [el, data[el]]).map((el) => (typeof el[1] === 'object' && el[1] && (!Array.isArray(el[1]) || typeof el[1]?.[0] === 'object') ? JSON.stringify(el[1]) : el[1]));
19
-
20
- const updateQuery = `UPDATE ${table} SET ${filterData?.map((key, i) => (key === 'geom' ? `"${key}"=st_setsrid(st_geomfromgeojson($${i + 2}::json),4326)` : `"${key}"=$${i + 2}`)).join(',')}
21
- WHERE ${pk} = $1 returning *`;
22
- // console.log(updateQuery, filterValue);
23
- const res = await pg.query(updateQuery, [id, ...filterValue]).then(el => el?.rows?.[0]) || {};
24
-
25
- await logChanges({
26
- pg, table, data, id, uid, type: 'UPDATE',
27
- });
28
-
29
- return res;
30
- }
1
+ import getPG from '../../pg/funcs/getPG.js';
2
+
3
+ import getMeta from '../../pg/funcs/getMeta.js';
4
+ import logChanges from './utils/logChanges.js';
5
+
6
+ export default async function dataUpdate({
7
+ table, id, data, pg: pg1, uid,
8
+ }) {
9
+ if (!data || !table || !id) return null;
10
+
11
+ const pg = pg1 || getPG({ name: 'client' });
12
+ const { columns, pk } = await getMeta(table);
13
+
14
+ const names = columns?.map((el) => el.name);
15
+ const filterData = Object.keys(data)
16
+ .filter((el) => (/* typeof data[el] === 'boolean' ? true : data[el] && */ names?.includes(el)));
17
+
18
+ const filterValue = filterData.map((el) => [el, data[el]]).map((el) => (typeof el[1] === 'object' && el[1] && (!Array.isArray(el[1]) || typeof el[1]?.[0] === 'object') ? JSON.stringify(el[1]) : el[1]));
19
+
20
+ const updateQuery = `UPDATE ${table} SET ${filterData?.map((key, i) => (key === 'geom' ? `"${key}"=st_setsrid(st_geomfromgeojson($${i + 2}::json),4326)` : `"${key}"=$${i + 2}`)).join(',')}
21
+ WHERE ${pk} = $1 returning *`;
22
+ // console.log(updateQuery, filterValue);
23
+ const res = await pg.query(updateQuery, [id, ...filterValue]).then(el => el?.rows?.[0]) || {};
24
+
25
+ await logChanges({
26
+ pg, table, data, id, uid, type: 'UPDATE',
27
+ });
28
+
29
+ return res;
30
+ }
@@ -1,27 +1,27 @@
1
- import getRedis from '../../redis/funcs/getRedis.js';
2
- import config from '../../config.js';
3
-
4
- function sprintf(str, ...args) {
5
- return str.replace(/%s/g, () => args.shift());
6
- }
7
-
8
- const keys = {
9
- r: '%s:token:view:%s',
10
- a: '%s:token:add:%s',
11
- w: '%s:token:edit:%s',
12
- e: '%s:token:exec:%s',
13
- };
14
-
15
- async function getToken({
16
- uid, token, mode = 'r', json,
17
- }) {
18
- if (mode === 'r') return token;
19
-
20
- const rclient = getRedis({ db: 0 });
21
-
22
- const key = sprintf(keys[mode], config?.pg?.database, uid?.toString());
23
- const id = await rclient.hget(key, token);
24
- return json && id?.[0] === '{' ? JSON.parse(id) : id;
25
- }
26
-
27
- export default getToken;
1
+ import getRedis from '../../redis/funcs/getRedis.js';
2
+ import config from '../../config.js';
3
+
4
+ function sprintf(str, ...args) {
5
+ return str.replace(/%s/g, () => args.shift());
6
+ }
7
+
8
+ const keys = {
9
+ r: '%s:token:view:%s',
10
+ a: '%s:token:add:%s',
11
+ w: '%s:token:edit:%s',
12
+ e: '%s:token:exec:%s',
13
+ };
14
+
15
+ async function getToken({
16
+ uid, token, mode = 'r', json,
17
+ }) {
18
+ if (mode === 'r') return token;
19
+
20
+ const rclient = getRedis({ db: 0 });
21
+
22
+ const key = sprintf(keys[mode], config?.pg?.database, uid?.toString());
23
+ const id = await rclient.hget(key, token);
24
+ return json && id?.[0] === '{' ? JSON.parse(id) : id;
25
+ }
26
+
27
+ export default getToken;
@@ -1,13 +1,13 @@
1
- import { access } from 'fs/promises';
2
-
3
- const isFileExists = async (filepath) => {
4
- try {
5
- await access(filepath);
6
- return true;
7
- }
8
- catch (err) {
9
- return false;
10
- }
11
- };
12
-
13
- export default isFileExists;
1
+ import { access } from 'fs/promises';
2
+
3
+ const isFileExists = async (filepath) => {
4
+ try {
5
+ await access(filepath);
6
+ return true;
7
+ }
8
+ catch (err) {
9
+ return false;
10
+ }
11
+ };
12
+
13
+ export default isFileExists;
@@ -1,53 +1,53 @@
1
- import { createHash, randomUUID } from 'crypto';
2
-
3
- import config from '../../config.js';
4
- import getRedis from '../../redis/funcs/getRedis.js';
5
-
6
- const generateCodes = (ids, userToken) => {
7
- const token = userToken || randomUUID();
8
- const notNullIds = ids.filter((el) => el);
9
- const obj = {};
10
- const codes = notNullIds.reduce((acc, id) => {
11
- const newToken = createHash('sha1').update(token + id).digest('base64url').replace(/-/g, '');
12
- acc[newToken] = id; obj[id] = newToken;
13
- return acc;
14
- }, {});
15
- return { codes, obj };
16
- };
17
-
18
- function setToken({
19
- ids: idsOrigin, mode = 'r', uid, referer, array,
20
- }) {
21
- const rclient2 = getRedis({ db: 0 });
22
- // const rclient5 = getRedis({ db: 0, funcs });
23
-
24
- if (!uid) return { user: 'empty' };
25
- if (!Object.keys(idsOrigin).length) return { ids: 'empty' };
26
-
27
- const ids = idsOrigin.map((el) => (typeof el === 'object' ? JSON.stringify(el) : el));
28
- // update/delete
29
-
30
- if (mode === 'r') return null;
31
-
32
- // TODO generate salt
33
- const { codes, obj } = generateCodes(ids, uid);
34
-
35
- if (!Object.keys(codes).length) return { ids: 'empty' };
36
-
37
- rclient2.hmset(`${config.pg.database}:token:${{
38
- e: 'exec', r: 'view', w: 'edit', a: 'add',
39
- }[mode]}:${uid}`, codes);
40
-
41
- // log token for debug. add extra data - uid, mode, date
42
- /* const dt = new Date().toISOString();
43
- const codesLog = Object.keys(codes).reduce((acc, key) => {
44
- acc[key] = `{"referer": "${referer}" ,"uid":"${uid}","mode":"${mode}","date":"${dt}",${codes[key].substr(1)}`;
45
- return acc;
46
- }, {});
47
- rclient5.hmset(`${config.pg.database}:token:edit`, codesLog); // 'EX', 64800 */
48
-
49
- // TODO дополнительно писать в hset token -> uid
50
- return array ? Object.values(obj) : obj;
51
- }
52
-
53
- export default setToken;
1
+ import { createHash, randomUUID } from 'crypto';
2
+
3
+ import config from '../../config.js';
4
+ import getRedis from '../../redis/funcs/getRedis.js';
5
+
6
+ const generateCodes = (ids, userToken) => {
7
+ const token = userToken || randomUUID();
8
+ const notNullIds = ids.filter((el) => el);
9
+ const obj = {};
10
+ const codes = notNullIds.reduce((acc, id) => {
11
+ const newToken = createHash('sha1').update(token + id).digest('base64url').replace(/-/g, '');
12
+ acc[newToken] = id; obj[id] = newToken;
13
+ return acc;
14
+ }, {});
15
+ return { codes, obj };
16
+ };
17
+
18
+ function setToken({
19
+ ids: idsOrigin, mode = 'r', uid, referer, array,
20
+ }) {
21
+ const rclient2 = getRedis({ db: 0 });
22
+ // const rclient5 = getRedis({ db: 0, funcs });
23
+
24
+ if (!uid) return { user: 'empty' };
25
+ if (!Object.keys(idsOrigin).length) return { ids: 'empty' };
26
+
27
+ const ids = idsOrigin.map((el) => (typeof el === 'object' ? JSON.stringify(el) : el));
28
+ // update/delete
29
+
30
+ if (mode === 'r') return null;
31
+
32
+ // TODO generate salt
33
+ const { codes, obj } = generateCodes(ids, uid);
34
+
35
+ if (!Object.keys(codes).length) return { ids: 'empty' };
36
+
37
+ rclient2.hmset(`${config.pg.database}:token:${{
38
+ e: 'exec', r: 'view', w: 'edit', a: 'add',
39
+ }[mode]}:${uid}`, codes);
40
+
41
+ // log token for debug. add extra data - uid, mode, date
42
+ /* const dt = new Date().toISOString();
43
+ const codesLog = Object.keys(codes).reduce((acc, key) => {
44
+ acc[key] = `{"referer": "${referer}" ,"uid":"${uid}","mode":"${mode}","date":"${dt}",${codes[key].substr(1)}`;
45
+ return acc;
46
+ }, {});
47
+ rclient5.hmset(`${config.pg.database}:token:edit`, codesLog); // 'EX', 64800 */
48
+
49
+ // TODO дополнительно писать в hset token -> uid
50
+ return array ? Object.values(obj) : obj;
51
+ }
52
+
53
+ export default setToken;
@@ -12,13 +12,16 @@ function formatData(fieldType = 'text', value = null) {
12
12
  }
13
13
  return value ? `'${value}'::${fieldType}` : null;
14
14
  }
15
- /* if (fieldType.includes('json') && Array.isArray(value)) {
16
- return value;
17
- } */
15
+ if (typeof value === 'object' || fieldType.includes('json')) {
16
+ if (Array.isArray(value)) {
17
+ return `'${JSON.stringify(value)}'`;
18
+ }
19
+ return `'${JSON.stringify(value)}'`;
20
+ }
18
21
  if (Array.isArray(value)) {
19
22
  return `'{ ${value.join(',')} }'::${fieldType}`;
20
23
  }
21
- return typeof value === 'object' ? JSON.stringify(value) : `'${value || null}'`;
24
+ return `'${value || null}'`;
22
25
  }
23
26
 
24
27
  export default async function logChanges({
@@ -1,76 +1,79 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
-
4
- const time = Date.now();
5
-
6
- import getPG from '../pg/funcs/getPG.js';
7
-
8
- export default async function execMigrations(opt) {
9
- try {
10
- const pg = opt?.pg || getPG({ name: 'client' });
11
- const rootDir = getCallerDir();
12
- const dir = path.join(rootDir.replace(/\\/g, '/').replace(/^file:\/\/\//, ''), rootDir.endsWith('plugins') ? '../..' : '', 'server/migrations');
13
-
14
- console.log('migrations start', dir, Date.now() - time);
15
- const exists = fs.existsSync(dir);
16
- if (exists) {
17
- // get directory sql file list
18
- const content = fs.readdirSync(dir, { withFileTypes: true })
19
- ?.filter((el) => el.isFile() && path.extname(el.name) === '.sql')
20
- ?.map((el) => el.name) || [];
21
-
22
- // execute sql files
23
- if (content?.length) {
24
- await sequence(content, { pg, dir }, execSql);
25
- }
26
- }
27
- console.log('migrations finish', dir, exists, Date.now() - time);
28
- } catch(err) {
29
- console.error('migrations error', err.toString(), Date.now() - time);
30
- }
31
- }
32
-
33
- function getCallerDir() {
34
- const originalFunc = Error.prepareStackTrace;
35
-
36
- let callerfile;
37
- try {
38
- const err = new Error();
39
- let currentfile;
40
-
41
- Error.prepareStackTrace = function (err, stack) { return stack; };
42
-
43
- currentfile = err.stack.shift().getFileName();
44
-
45
- while (err.stack.length) {
46
- callerfile = err.stack.shift().getFileName();
47
-
48
- if(currentfile !== callerfile) break;
49
- }
50
- } catch (err) { }
51
-
52
- Error.prepareStackTrace = originalFunc;
53
-
54
- return path.dirname(callerfile);
55
- }
56
-
57
- function sequence(files, data, fn) {
58
- return files.reduce((promise, filename) => promise.then(() => fn({
59
- ...data, filename,
60
- })), Promise.resolve());
61
- }
62
-
63
- async function execSql({
64
- pg, dir, filename,
65
- }) {
66
- const start = Date.now();
67
- const filepath = path.join(dir, filename);
68
- const sql = fs.readFileSync(filepath, 'utf-8');
69
- try {
70
- console.log(filename, 'start', Date.now() - start);
71
- await pg.query(sql);
72
- console.log(filename, 'finish', Date.now() - start);
73
- } catch (err) {
74
- console.log(filepath, 'error', err.toString(), Date.now() - start);
75
- }
76
- }
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+
4
+ const time = Date.now();
5
+
6
+ import getPG from '../pg/funcs/getPG.js';
7
+
8
+ function getCallerDir() {
9
+ const originalFunc = Error.prepareStackTrace;
10
+
11
+ let callerfile;
12
+ try {
13
+ const err = new Error();
14
+ // let currentfile;
15
+
16
+ Error.prepareStackTrace = function (err, stack) { return stack; };
17
+
18
+ const currentfile = err.stack.shift().getFileName();
19
+
20
+ while (err.stack.length) {
21
+ callerfile = err.stack.shift().getFileName();
22
+
23
+ if (currentfile !== callerfile) break;
24
+ }
25
+ }
26
+ catch (err) { }
27
+
28
+ Error.prepareStackTrace = originalFunc;
29
+
30
+ return path.dirname(callerfile);
31
+ }
32
+
33
+ function sequence(files, data, fn) {
34
+ return files.reduce((promise, filename) => promise.then(() => fn({
35
+ ...data, filename,
36
+ })), Promise.resolve());
37
+ }
38
+
39
+ async function execSql({
40
+ pg, dir, filename,
41
+ }) {
42
+ const start = Date.now();
43
+ const filepath = path.join(dir, filename);
44
+ const sql = fs.readFileSync(filepath, 'utf-8');
45
+ try {
46
+ console.log(filename, 'start', Date.now() - start);
47
+ await pg.query(sql);
48
+ console.log(filename, 'finish', Date.now() - start);
49
+ }
50
+ catch (err) {
51
+ console.log(filepath, 'error', err.toString(), Date.now() - start);
52
+ }
53
+ }
54
+
55
+ export default async function execMigrations(opt) {
56
+ try {
57
+ const pg = opt?.pg || getPG({ name: 'client' });
58
+ const rootDir = getCallerDir();
59
+ const dir = path.join(rootDir.replace(/\\/g, '/').replace(/^file:\/\/\//, ''), rootDir.endsWith('plugins') ? '../..' : '', 'server/migrations');
60
+
61
+ console.log('migrations start', dir, Date.now() - time);
62
+ const exists = fs.existsSync(dir);
63
+ if (exists) {
64
+ // get directory sql file list
65
+ const content = fs.readdirSync(dir, { withFileTypes: true })
66
+ ?.filter((el) => el.isFile() && path.extname(el.name) === '.sql')
67
+ ?.map((el) => el.name) || [];
68
+
69
+ // execute sql files
70
+ if (content?.length) {
71
+ await sequence(content, { pg, dir }, execSql);
72
+ }
73
+ }
74
+ console.log('migrations finish', dir, exists, Date.now() - time);
75
+ }
76
+ catch (err) {
77
+ console.error('migrations error', err.toString(), Date.now() - time);
78
+ }
79
+ }