@wmfs/pg-telepods
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -0,1 +1,19 @@ | ||
# [1.4.0](https://github.com/wmfs/pg-telepods/compare/v1.3.0...v1.4.0) (2018-07-31) | ||
### ✨ Features | ||
* Can sync to a subset of the target table ([feecd55](https://github.com/wmfs/pg-telepods/commit/feecd55)) | ||
### 🚨 Tests | ||
* Correct E string test ([8c9f8ab](https://github.com/wmfs/pg-telepods/commit/8c9f8ab)) | ||
* Define generate-where-clause ([93f3e10](https://github.com/wmfs/pg-telepods/commit/93f3e10)) | ||
### 🗑 Reverts | ||
* Reenable partial-table tests ([2f4624b](https://github.com/wmfs/pg-telepods/commit/2f4624b)) | ||
# [1.3.0](https://github.com/wmfs/pg-telepods/compare/v1.2.0...v1.3.0) (2018-07-31) | ||
@@ -2,0 +20,0 @@ |
@@ -8,2 +8,3 @@ 'use strict' | ||
const promisify = require('util').promisify | ||
const generateWhereClause = require('./generate-where-clause') | ||
@@ -20,2 +21,3 @@ module.exports = promisify(processDeletes) | ||
const deleteSql = `select ${targetPk} from ${options.target.tableName} ` + | ||
generateWhereClause(options.target.where) + | ||
` except ` + | ||
@@ -22,0 +24,0 @@ ` select ${sourcePk} from ${options.source.tableName} ` |
{ | ||
"name": "@wmfs/pg-telepods", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Takes the contents of one PostgreSQL table, applies a transformation function to each row and ensures a target table is kept in sync", | ||
@@ -5,0 +5,0 @@ "author": "West Midlands Fire Service", |
@@ -13,3 +13,3 @@ /* eslint-env mocha */ | ||
xdescribe('partial-table test', | ||
describe('partial-table test', | ||
function () { | ||
@@ -36,2 +36,5 @@ this.timeout(process.env.TIMEOUT || 5000) | ||
const firstSyncOutputDir = path.resolve(__dirname, './output', 'first-partial') | ||
const secondSyncOutputDir = path.resolve(__dirname, './output', 'second-partial') | ||
describe('sync first table', () => { | ||
@@ -41,3 +44,3 @@ it('start the telepods', async () => { | ||
client: client, | ||
outputDir: path.resolve(__dirname, './output'), | ||
outputDir: firstSyncOutputDir, | ||
source: { | ||
@@ -51,3 +54,3 @@ tableName: 'springfield.people', | ||
where: { | ||
town: {equals: 'Springfield'} | ||
town: { equals: 'Springfield' } | ||
} | ||
@@ -123,3 +126,3 @@ }, | ||
it('check for deletes csv', () => { | ||
const censusDeletes = path.resolve(__dirname, './output/deletes/census.csv') | ||
const censusDeletes = path.resolve(firstSyncOutputDir, 'deletes', 'census.csv') | ||
expect(fs.existsSync(censusDeletes)).to.equal(true) | ||
@@ -136,3 +139,3 @@ | ||
client: client, | ||
outputDir: path.resolve(__dirname, './output'), | ||
outputDir: secondSyncOutputDir, | ||
source: { | ||
@@ -196,3 +199,3 @@ tableName: 'worldof.tomorrow', | ||
'name': 'Philip J. Fry', | ||
'origin_hash_sum': 'ABCDEFGH', | ||
'origin_hash_sum': 'ABCDEFGQ', | ||
'id_number': 20, | ||
@@ -215,3 +218,3 @@ 'town': 'New New York' | ||
'name': 'Bender', | ||
'origin_hash_sum': 'JKLMNOPQ', | ||
'origin_hash_sum': 'AAAAAAAA', | ||
'id_number': 27, | ||
@@ -225,7 +228,7 @@ 'town': 'New New York' | ||
it('check for deletes csv', () => { | ||
const censusDeletes = path.resolve(__dirname, './output/deletes/census.csv') | ||
const censusDeletes = path.resolve(secondSyncOutputDir, 'deletes', 'census.csv') | ||
expect(fs.existsSync(censusDeletes)).to.equal(true) | ||
const deletes = fs.readFileSync(censusDeletes, { encoding: 'utf-8' }) | ||
expect(deletes.split('\n').length).to.equal(1) | ||
expect(deletes.split('\n').length).to.equal(3) | ||
}) | ||
@@ -232,0 +235,0 @@ }) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
38300
25
684