-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbinit.js
28 lines (23 loc) · 841 Bytes
/
dbinit.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
const models = require("./models/models");
const inkyauth = require("./inkyauth");
// const val = require("validator");
const knex = require('knex')({
dialect: 'sqlite3',
connection: {
filename: './main.db'
}
});
function inkyct(tablename, schema) {
return knex.schema.createTableIfNotExists(tablename, function (table) {
table.increments();
table.timestamps(true,true);
for (let field in schema) {
table.text(field);
}
});
}
// knex.dropTableIfExists("formdata").then(() =>
// inkyct("formdata", schemas.formdata).then(() => knex.destroy(() => console.log("closing after creation"))) // )
// inkyct("users", schemas.user()).then(() => knex.destroy(() => console.log("closing after creation"))) // )
// testvalues
inkyauth.createuser("test2","test2").then(() => console.log("success"), (err) => console.log(err))