Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Oct 13, 2023
1 parent b2d232e commit 6599be6
Show file tree
Hide file tree
Showing 17 changed files with 602 additions and 646 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import sqlite from 'better-sqlite3';
import Debug from 'debug';
import { nhtsaDB as nhtsaDatabasePath } from '../data/databasePaths.js';
import debug from 'debug';
const debugSQL = debug('parking-ticket-system:initializeDatabase');
const debug = Debug('parking-ticket-system:initializeDatabase');
export const initNHTSADB = () => {
const nhtsaDB = sqlite(nhtsaDatabasePath);
let doCreate = false;
const row = nhtsaDB
.prepare("select name from sqlite_master where type = 'table' and name = 'MakeModel'")
.get();
if (!row) {
debugSQL('Creating ' + nhtsaDatabasePath);
if (row === undefined) {
debug('Creating ' + nhtsaDatabasePath);
doCreate = true;
nhtsaDB
.prepare('create table if not exists MakeModelSearchHistory (' +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import sqlite from 'better-sqlite3'
import Debug from 'debug'

import { nhtsaDB as nhtsaDatabasePath } from '../data/databasePaths.js'

import debug from 'debug'
const debugSQL = debug('parking-ticket-system:initializeDatabase')
const debug = Debug('parking-ticket-system:initializeDatabase')

export const initNHTSADB = (): boolean => {
const nhtsaDB = sqlite(nhtsaDatabasePath)
Expand All @@ -16,8 +16,8 @@ export const initNHTSADB = (): boolean => {
)
.get()

if (!row) {
debugSQL('Creating ' + nhtsaDatabasePath)
if (row === undefined) {
debug('Creating ' + nhtsaDatabasePath)
doCreate = true

nhtsaDB
Expand Down
2 changes: 1 addition & 1 deletion database/parkingDB/initializeDatabase.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const initializeDatabase: () => boolean;
export declare function initializeDatabase(): boolean;
396 changes: 191 additions & 205 deletions database/parkingDB/initializeDatabase.js

Large diffs are not rendered by default.

Loading

0 comments on commit 6599be6

Please sign in to comment.