diff --git a/db/create.js b/db/create.js index ce85e59..ac34dcb 100644 --- a/db/create.js +++ b/db/create.js @@ -2,7 +2,16 @@ const con = require('./connect.js'); con.con.connect(function(err) { if (err) throw err; - let sql = 'CREATE TABLE smartTag2 (code VARCHAR(100) PRIMARY KEY, shelvingFk VARCHAR(10) FOREIGN KEY REFERENCES vn.shelving(code), level INT(11))'; + let sql = `CREATE TABLE vn.smartTag ( + code varchar(100) NOT NULL, + shelvingFk varchar(10) NULL, + \`level\` int(11) NULL, + CONSTRAINT \`PRIMARY\` PRIMARY KEY (code), + CONSTRAINT smartTag_FK FOREIGN KEY (shelvingFk) REFERENCES vn.shelving(code) + ) + ENGINE=InnoDB + DEFAULT CHARSET=utf8 + COLLATE=utf8_general_ci;`; con.con.query(sql, function(err, result) { if (err) throw err; }); diff --git a/server.js b/server.js index 2ed1a00..f849431 100644 --- a/server.js +++ b/server.js @@ -7,8 +7,8 @@ const dataLogIn = logIn.info; exports.dataLogIn = dataLogIn; app.use('/getNumShelving', require('./methods/setCollection')); -app.use('/bindShelving', require('./methods/bindShelvingTag')); app.use('/insertTicket', require('./methods/bindTicketShelving')); +app.use('/bindShelving', require('./methods/bindShelvingTag')); app.listen(port, () => { console.log(`Example app listening at http://localhost:${port}`);