不要怂,就是干,撸起袖子干!

Commit 6d19ea29 by Sushant Committed by GitHub

fix(sequelize/constructor): queryInterface was initialized on first use (#8178)

1 parent fc942b08
......@@ -27,7 +27,7 @@ function addForeignKeyConstraints(newAttribute, source, target, options, key) {
if (primaryKeys.length === 1) {
if (source._schema) {
newAttribute.references = {
model: source.sequelize.queryInterface.QueryGenerator.addSchema({
model: source.sequelize.getQueryInterface().QueryGenerator.addSchema({
tableName: source.tableName,
_schema: source._schema,
_schemaDelimiter: source._schemaDelimiter
......
......@@ -57,7 +57,7 @@ class Query extends AbstractQuery {
this.sql = sql;
if (!Utils._.isEmpty(this.options.searchPath)) {
this.sql = this.sequelize.queryInterface.QueryGenerator.setSearchPath(this.options.searchPath) + sql;
this.sql = this.sequelize.getQueryInterface().QueryGenerator.setSearchPath(this.options.searchPath) + sql;
}
const query = parameters && parameters.length
......@@ -129,7 +129,7 @@ class Query extends AbstractQuery {
// Map column index in table to column name
const columns = _.zipObject(
row.column_indexes,
this.sequelize.queryInterface.QueryGenerator.fromArray(row.column_names)
this.sequelize.getQueryInterface().QueryGenerator.fromArray(row.column_names)
);
delete row.column_indexes;
delete row.column_names;
......@@ -203,7 +203,7 @@ class Query extends AbstractQuery {
type: row.Type.toUpperCase(),
allowNull: row.Null === 'YES',
defaultValue: row.Default,
special: row.special ? this.sequelize.queryInterface.QueryGenerator.fromArray(row.special) : [],
special: row.special ? this.sequelize.getQueryInterface().QueryGenerator.fromArray(row.special) : [],
primaryKey: row.Constraint === 'PRIMARY KEY'
};
......
......@@ -224,10 +224,12 @@ class Sequelize {
default:
throw new Error('The dialect ' + this.getDialect() + ' is not supported. Supported dialects: mssql, mysql, postgres, and sqlite.');
}
this.dialect = new Dialect(this);
this.dialect = new Dialect(this);
this.dialect.QueryGenerator.typeValidation = options.typeValidation;
this.queryInterface = new QueryInterface(this);
/**
* Models are stored here under the name given to `sequelize.define`
*/
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!