Loading lib/database.js +2 −0 Changes for lib/database.js: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -190,6 +190,8 @@ Database.prototype.clean = function () { return []; }, []); this.entityCache = {}; }; /** Loading test/database/reload.js +16 −3 Changes for test/database/reload.js: 16 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ describe('reload', function () { let db; before(function* () { const initDb = yield resetDb('multi-schema'); const initDb = yield resetDb('foreign-keys'); // reconnect with a pool size of 1 to make it easier to change runtime settings on all connections db = yield massive({ Loading @@ -20,13 +20,26 @@ describe('reload', function () { after(() => db.instance.$pool.end()); it('expires the compound entity cache on db.reload()', async function () { const a = db.alpha.join('beta'); await db.reload(); assert.isEmpty(db.entityCache); const b = db.alpha.join('beta'); assert.notEqual(a, b); }); it('defaults currentSchema to "public"', () => { assert.equal(db.currentSchema, 'public'); }); // this test case changes the search path and should remain last in the file it('picks up change in current schema', () => { return db.query('SET search_path=test') return db.query('SET search_path=sch') .then(() => db.reload()) .then(() => assert.equal(db.currentSchema, 'test')); .then(() => assert.equal(db.currentSchema, 'sch')); }); }); test/helpers/scripts/multi-schema/schema.sqldeleted 100644 → 0 +0 −2 Changes for test/helpers/scripts/multi-schema/schema.sql: 0 added lines, 2 removed lines. Original line number Diff line number Diff line CREATE SCHEMA public; CREATE SCHEMA test; No newline at end of file Loading
lib/database.js +2 −0 Changes for lib/database.js: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -190,6 +190,8 @@ Database.prototype.clean = function () { return []; }, []); this.entityCache = {}; }; /** Loading
test/database/reload.js +16 −3 Changes for test/database/reload.js: 16 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ describe('reload', function () { let db; before(function* () { const initDb = yield resetDb('multi-schema'); const initDb = yield resetDb('foreign-keys'); // reconnect with a pool size of 1 to make it easier to change runtime settings on all connections db = yield massive({ Loading @@ -20,13 +20,26 @@ describe('reload', function () { after(() => db.instance.$pool.end()); it('expires the compound entity cache on db.reload()', async function () { const a = db.alpha.join('beta'); await db.reload(); assert.isEmpty(db.entityCache); const b = db.alpha.join('beta'); assert.notEqual(a, b); }); it('defaults currentSchema to "public"', () => { assert.equal(db.currentSchema, 'public'); }); // this test case changes the search path and should remain last in the file it('picks up change in current schema', () => { return db.query('SET search_path=test') return db.query('SET search_path=sch') .then(() => db.reload()) .then(() => assert.equal(db.currentSchema, 'test')); .then(() => assert.equal(db.currentSchema, 'sch')); }); });
test/helpers/scripts/multi-schema/schema.sqldeleted 100644 → 0 +0 −2 Changes for test/helpers/scripts/multi-schema/schema.sql: 0 added lines, 2 removed lines. Original line number Diff line number Diff line CREATE SCHEMA public; CREATE SCHEMA test; No newline at end of file