brain issue (again)

This commit is contained in:
furo 2021-11-02 00:19:38 +01:00
parent 28db385c86
commit 06fcfb65ac

View File

@ -14,13 +14,13 @@ export function generateDB() {
return log("Won't generate the database since 'GENERATE_DB' is not set to \"true\" in '.env'!") return log("Won't generate the database since 'GENERATE_DB' is not set to \"true\" in '.env'!")
const exists = sqlite.prepare(`SELECT count(*) as a FROM sqlite_master WHERE type='table' AND name='points'`).get() const exists = sqlite.prepare(`SELECT count(*) as a FROM sqlite_master WHERE type='table' AND name='points'`).get()
if(exists.a === 0) if(!exists.a === 0)
return log("Database already generated!") return log("Database already generated!")
/* Check if columns are already renamed */ /* Check if columns are already renamed */
const renamed = sqlite.prepare(`SELECT COUNT(*) AS a FROM pragma_table_info('race') WHERE name='date'`).get() const renamed = sqlite.prepare(`SELECT COUNT(*) AS a FROM pragma_table_info('race') WHERE name='date'`).get()
if(!renamed.a === 0) { if(renamed.a === 0) {
log("Renaming columns...") log("Renaming columns...")
execMany([ execMany([
`ALTER TABLE race RENAME COLUMN Map TO map`, `ALTER TABLE race RENAME COLUMN Map TO map`,