Last active
March 20, 2021 15:45
-
-
Save jgengo/c2cc68660c5cade3df0ca7e9f91d765f to your computer and use it in GitHub Desktop.
database.js file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sqlite3 = require('sqlite3').verbose(); | |
const db = new sqlite3.Database('./database.db', [sqlite3.OPEN_CREATE, sqlite3.OPEN_READWRITE], (err) => { | |
if (err) console.error(err.message) | |
}); | |
db.run(`create table if not exists users (id text, name text)`) | |
db.run(` | |
create table if not exists logs( | |
id integer primary key, | |
author_id text, | |
recipient_id text, | |
words_count integer default 0, | |
chars_count integer default 0, | |
created_at text not null default (datetime('now','localtime')) | |
); | |
`) | |
module.exports = db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment