为什么Sequelize发布“SHOW INDEX FROM`table`”?(Why Sequelize issues “SHOW INDEX FROM `table`”?)
如果要启用
Sequelize
日志记录,您会看到在“同步”阶段和创建表之后,Sequelize
执行SHOW INDEX FROM table
查询。 问题是 - 为什么?
更具体地说,这是我正在执行的代码:
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 });
这是控制台上的输出:
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`
If you would enable
Sequelize
logging, you would see that during the "sync" phase and right after creating a table,Sequelize
executesSHOW 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`
原文:https://stackoverflow.com/questions/37893128
更新时间:2021-11-07 10:11
最满意答案
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); Console.WriteLine(config.FilePath);
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); Console.WriteLine(config.FilePath);
相关问答
更多-
天啊!!! 我发现问题。 我没有检查在Windows资源管理器选项'显示所有已知的文件扩展名',我保存web.config与TXT延长,我没有看到这种荒谬的错误。 谢谢你的帮助! Oh my gosh!!! I found issue. I haven't checked in windows explorer option 'show all known file extentions' and I saved web.config with txt extention and I haven't see ...
-
mongodb配置文件(mongodb config file)[2023-03-02]
fork不是有效的Windows参数。 有关更全面的描述,请参阅此问题: Windows中的mongodb fork 您可能需要考虑将YAML格式用于配置文件。 随着配置的增长,它们将更具可读性: http : //docs.mongodb.org/manual/reference/configuration-options/ fork is not a valid Windows parameter. See this question for a fuller description: mongodb ... -
只需将所有文件名传递给configparser 。 它在文档中 : 尝试读取并解析文件名列表,返回已成功解析的文件名列表。 如果文件名是字符串或Unicode字符串,则将其视为单个文件名。 如果无法打开文件名中指定的文件,则将忽略该文件。 这样设计使您可以指定潜在配置文件位置的列表(例如,当前目录,用户的主目录和某些系统范围的目录),并且将读取列表中的所有现有配置文件。 如果不存在任何命名文件,则ConfigParser实例将包含空数据集。 需要从文件加载初始值的应用程序应在为任何可选文件调用read()之 ...
-
配置文件和PhoneGap(Config file and PhoneGap)[2024-01-06]
尝试ConfiGAP,它会为你生成config.xml。 ConfiGAP是一个旨在帮助您创建Adobe®PhoneGap™Build使用的config.xml文件的应用程序。 http://configap.com/ The problem I was experiencing was because I had Hydration turned on. Turning off Hydration meant that most of the config options were honoured. I ... -
WPML配置文件(WPML config file)[2022-06-29]
它缺少主选项键。 它应该是:block_1 -
配置文件和Reltool(Config files and Reltool)[2022-01-13]
您不需要拥有自己的配置文件,除非它是出于特殊目的。 如果您的配置文件与版本不同,您可以将这些不同的配置添加到/ebin/ .app 。 您可以将默认配置变量设置为 /ebin/ .app 。 有关此问题的更多详细信息,请参阅http://www.erlang.org/doc/man/app.html 然后,您可以使用application:get_env( , , < ... -
答:你不应该使用那么多@DependsOn注释。 来自javadoc: 在bean没有通过属性或构造函数参数显式依赖于另一个bean的情况下很少使用,而是依赖于另一个bean的初始化的副作用。 你可以这样做: @Configuration public class MyConfig { @Bean public MovieClient movieClient(RestOperations rest) { return new MovieClientImpl(rest); } ...
-
识别有效的配置文件(Identifying the effective config file)[2023-05-04]
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); Console.WriteLine(config.FilePath); Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); Console.WriteLine(config.File ... -
xml使用配置文件(xml to use config file)[2022-08-20]
所以谁曾经使用sos jobscheduler或我假设其他调度员也可以使用shell脚本来调用bat文件。