We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eab34b1 commit 75e090dCopy full SHA for 75e090d
1 file changed
helpers/dbHelper.js
@@ -13,20 +13,17 @@ module.exports = {
13
* already exist
14
*/
15
ensureDatabase: () => {
16
- const dbExists = fs.existsSync(dbFile);
17
const db = new sqlite3.Database(dbFile);
18
const createSubscriptionStatement =
19
- 'CREATE TABLE Subscription (' +
+ 'CREATE TABLE IF NOT EXISTS Subscription (' +
20
'SubscriptionId TEXT NOT NULL, ' +
21
'UserAccountId TEXT NOT NULL' +
22
')';
23
24
db.serialize(() => {
25
- if (!dbExists) {
26
- db.run(createSubscriptionStatement, (error) => {
27
- if (error) throw error;
28
- });
29
- }
+ db.run(createSubscriptionStatement, (error) => {
+ if (error) throw error;
+ });
30
});
31
32
db.close();
0 commit comments