Hi I’m new to sequelize and am having some issues do you know why the code I’m executing where I’m trying to query a table that is already in the database is creating a new table each time I run this but with an ‘S’ added on?const Sequelize = require('sequelize'); const connection = new Sequelize('nodejs_test', 'user', 'password', { host: 'localhost', dialect: 'mysql' }); const Games = connection.define('node', { video_game: Sequelize.STRING, system: Sequelize.STRING, }); Games.sync().then( () => { return Games.findAll().then(function(game) { console.log(game) }) }); this is what I'm seeing in my terminal after it's completed:Executing (default): CREATE TABLE IF NOT EXISTS nodes (id INTEGER NOT NULL auto_increment , video_game VARCHAR(255), system VARCHAR(255), createdAt DATETIME NOT NULL, updatedAt DATETIME NOT NULL, PRIMARY KEY (id)) ENGINE=InnoDB; Executing (default): SHOW INDEX FROM nodes Executing (default): SELECT id, video_game, system, createdAt, updatedAt FROM nodes AS node;
Submitted September 12, 2017 at 03:38AM by urlclsocalkid
No comments:
Post a Comment