Adding preliminary table work and breadalert framing
This commit is contained in:
@@ -17,7 +17,11 @@ export class SqliteDB implements sql_common {
|
||||
console.log(err)
|
||||
throw err
|
||||
} else {
|
||||
return result.changes
|
||||
if (result != null) {
|
||||
return result.changes
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
11
src/utilties/storage/tables.ts
Normal file
11
src/utilties/storage/tables.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { sql_common } from "./interfaces";
|
||||
|
||||
const tables: string[] = [
|
||||
"CREATE TABLE IF NOT EXISTS servers (server_snowflake bigint NOT NULL PRIMARY KEY,server_name text NOT NULL,server_description mediumtext);",
|
||||
"CREATE TABLE IF NOT EXISTS channels (channel_snowflake bigint NOT NULL PRIMARY KEY,server_snowflake bigint NOT NULL,channel_name text NOT NULL);"
|
||||
]
|
||||
|
||||
export async function makeTables(db: sql_common): Promise<number[]> {
|
||||
return Promise.all(tables.map((statement) => db.run(statement)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user