Skip to content

Instantly share code, notes, and snippets.

@DanyF-github
Created October 29, 2021 10:06
Show Gist options
  • Save DanyF-github/7821868aaccf90c942858d0b894e674f to your computer and use it in GitHub Desktop.
Save DanyF-github/7821868aaccf90c942858d0b894e674f to your computer and use it in GitHub Desktop.
// CONFIGURE DATABASE
const dbFile = './.data/sqlite.db';
var exists = fs.existsSync(dbFile);
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database(dbFile);
db.serialize(function(){
if (!exists) {
db.run('CREATE TABLE State (phone NUMERIC UNIQUE, state NUMERIC, memo TEXT)')
db.run('CREATE TABLE Users (phone NUMERIC UNIQUE, username TEXT, email TEXT, address TEXT)');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment