-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmigrate.js
29 lines (24 loc) · 1.05 KB
/
migrate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database('database.sqlite3');
db.serialize(() => {
db.run('DROP TABLE IF EXISTS professors ');
db.run('CREATE TABLE professors (user VARCHAR(255))');
const stmt = db.prepare('INSERT INTO professors VALUES ("ajsuarezf")');
stmt.run();
stmt.finalize();
db.each('SELECT user FROM professors', (err, row) => {
console.log(row.user);
});
db.run('DROP TABLE IF EXISTS request ');
db.run(
'CREATE TABLE request (request_id INTEGER PRIMARY KEY AUTOINCREMENT, ' +
'Nombre TEXT, Correo TEXT, Fecha TEXT, Programa TEXT, ' +
'Tipo_Documento TEXT, Documento TEXT, PBM TEXT, Procedencia TEXT, ' +
'Bogota TEXT, Celular TEXT, Direccion TEXT, Apoyo TEXT, ' +
'Descripcion TEXT, Apadrinado INTEGER)');
db.run('DROP TABLE IF EXISTS sponsor ');
db.run('CREATE TABLE sponsor (professor VARCHAR(255), request_id INTEGER)');
db.run('DROP TABLE IF EXISTS recommend ');
db.run('CREATE TABLE recommend (name TEXT, email TEXT, type TEXT, msg TEXT)');
});
db.close();