We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents eab34b1 + 75e090d commit 054df8bCopy full SHA for 054df8b
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