X-Git-Url: http://git.squeep.com/?p=squeep-indie-auther;a=blobdiff_plain;f=src%2Fdb%2Fpostgres%2Findex.js;fp=src%2Fdb%2Fpostgres%2Findex.js;h=3a536f48f5d4250cce11f0483843bbac74335b02;hp=5899a26fb436fd7a2bd708cfa1d3f129b350a346;hb=e7436419933940f90769c8be1d63acccdd947b92;hpb=6f9af8204a725b70fa65728cb0d627d8a5e5b348 diff --git a/src/db/postgres/index.js b/src/db/postgres/index.js index 5899a26..3a536f4 100644 --- a/src/db/postgres/index.js +++ b/src/db/postgres/index.js @@ -7,7 +7,7 @@ const pgpInitOptions = { const path = require('path'); const pgp = require('pg-promise')(pgpInitOptions); -const svh = require('../schema-version-helper'); +const { unappliedSchemaVersions } = require('../schema-version-helper'); const Database = require('../abstract'); const DBErrors = require('../errors'); const common = require('../../common'); @@ -15,10 +15,10 @@ const common = require('../../common'); const _fileScope = common.fileScope(__filename); const PGTypeIdINT8 = 20; // Type Id 20 == INT8 (BIGINT) -const PGTYpeIdINT8Array = 1016; //Type Id 1016 == INT8[] (BIGINT[]) +const PGTypeIdINT8Array = 1016; //Type Id 1016 == INT8[] (BIGINT[]) pgp.pg.types.setTypeParser(PGTypeIdINT8, BigInt); // Type Id 20 = INT8 (BIGINT) -const parseBigIntArray = pgp.pg.types.getTypeParser(PGTYpeIdINT8Array); // Type Id 1016 = INT8[] (BIGINT[]) -pgp.pg.types.setTypeParser(PGTYpeIdINT8Array, (a) => parseBigIntArray(a).map(BigInt)); +const parseBigIntArray = pgp.pg.types.getTypeParser(PGTypeIdINT8Array); // Type Id 1016 = INT8[] (BIGINT[]) +pgp.pg.types.setTypeParser(PGTypeIdINT8Array, (a) => parseBigIntArray(a).map(BigInt)); const schemaVersionsSupported = { min: { @@ -142,7 +142,7 @@ class DatabasePostgres extends Database { // Apply migrations const currentSchema = await this._currentSchema(); - const migrationsWanted = svh.unappliedSchemaVersions(__dirname, currentSchema, this.schemaVersionsSupported); + const migrationsWanted = unappliedSchemaVersions(__dirname, currentSchema, this.schemaVersionsSupported); this.logger.debug(_scope, 'schema migrations wanted', { migrationsWanted }); for (const v of migrationsWanted) { const fPath = path.join(__dirname, 'sql', 'schema', v, 'apply.sql');