From f6bec828d74ba8ad88ac646b47f6c3dca2bd9e35 Mon Sep 17 00:00:00 2001 From: TheEssem Date: Fri, 5 Mar 2021 15:20:15 -0600 Subject: [PATCH] Fixed database thing --- utils/database/postgres.js | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/database/postgres.js b/utils/database/postgres.js index 6c53ba8..40e9998 100644 --- a/utils/database/postgres.js +++ b/utils/database/postgres.js @@ -60,6 +60,7 @@ exports.getCounts = async () => { exports.addCount = async (command) => { const count = await connection.query("SELECT * FROM counts WHERE command = $1", [command]); + if (!count.rows[0]) await connection.query("INSERT INTO counts (command, count) VALUES ($1, $2)", [command, 0]); await connection.query("UPDATE counts SET count = $1 WHERE command = $2", [count.rows[0].count ? count.rows[0].count + 1 : 1, command]); };