OrwellHindenberg
OrwellHindenberg

Reputation: 5078

Sequelize not displaying CREATE TABLE statement in console

I'm using Sequelize as my ORM tool and like it pretty good so far. Right now I'm using it to create a table for me User.History (User = schema, History = table). This works correctly, I verify that the table doesn't exist (drop beforehand) and then I verify that the table exists after I start the table and do an insert.

I need the CREATE TABLE statement that Sequelize generates to show my DBA. However, I don't see it in the console. The INSERT statement I use to populate the User.History table appears, but not the CREATE TABLE. I've tried dropping the table multiple times to make sure it wasn't around when I was running the command.

I have also tried adding the logging: console.log option to the Sequelize instance without any luck.

If it would be helpful for me to include any code, please let me know.

Upvotes: 2

Views: 351

Answers (1)

Make sure you have logging: console.log in the params for the sync function. Like this:

const sequelize = new Sequelize(databaseUrl, {
  logging: console.log     // This is default
});

sequelize.sync({ 
  force: true, 
  logging: console.log    // This is NOT default
});

Upvotes: 1

Related Questions