Skip to content

Commit 343b0ae

Browse files
Update postgres.js
Update teardown function
1 parent 3f0cdcc commit 343b0ae

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/persistence/postgres.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ async function getItems() {
5959
}
6060

6161

62-
// Drop the table if it exists
62+
// End the connection
6363
async function teardown() {
64-
return client.query('DROP TABLE IF EXISTS todo_items').then(() => {
65-
console.log('Dropped the table');
66-
}).catch(err => {
67-
console.error('Unable to drop the table:', err);
68-
});
64+
return client.end().then(() => {
65+
console.log('Client ended');
66+
}).catch(err => {
67+
console.error('Unable to end client:', err);
68+
});
6969
}
7070

7171
// Get one item by id from the table

0 commit comments

Comments
 (0)