mercredi 6 juillet 2016
Why Sequelize issues "SHOW INDEX FROM `table`"?
If you would enable Sequelize logging, you would see that during the "sync" phase and right after creating a table, Sequelize executes SHOW INDEX FROM table query. The question is - why?
To be more specific, here is the code I'm executing:
var Sequelize = require('sequelize');
var connection = new Sequelize('demo_schema', 'root', 'password');
var Article = connection.define('article', {
slug: {
type: Sequelize.STRING,
primaryKey: true
},
title: {
type: Sequelize.STRING,
unique: true,
allowNull: false
},
body: {
type: Sequelize.TEXT
}
}, {
timestamps: false
});
connection.sync({
force: true,
logging: console.log
}).then(function () {
// TODO
});
Here is the output on the console:
Executing (default): DROP TABLE IF EXISTS `articles`;
Executing (default): DROP TABLE IF EXISTS `articles`;
Executing (default): CREATE TABLE IF NOT EXISTS `articles` (`slug` VARCHAR(255) , `title` VARCHAR(255) NOT NULL UNIQUE, `body` TEXT, UNIQUE `articles_title_unique` (`title`), PRIMARY KEY (`slug`)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `articles`
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire