Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 6d19ea29
authored
Aug 23, 2017
by
Sushant
Committed by
GitHub
Aug 23, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(sequelize/constructor): queryInterface was initialized on first use (#8178)
1 parent
fc942b08
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
lib/associations/helpers.js
lib/dialects/postgres/query.js
lib/sequelize.js
lib/associations/helpers.js
View file @
6d19ea2
...
@@ -27,7 +27,7 @@ function addForeignKeyConstraints(newAttribute, source, target, options, key) {
...
@@ -27,7 +27,7 @@ function addForeignKeyConstraints(newAttribute, source, target, options, key) {
if
(
primaryKeys
.
length
===
1
)
{
if
(
primaryKeys
.
length
===
1
)
{
if
(
source
.
_schema
)
{
if
(
source
.
_schema
)
{
newAttribute
.
references
=
{
newAttribute
.
references
=
{
model
:
source
.
sequelize
.
queryInterface
.
QueryGenerator
.
addSchema
({
model
:
source
.
sequelize
.
getQueryInterface
()
.
QueryGenerator
.
addSchema
({
tableName
:
source
.
tableName
,
tableName
:
source
.
tableName
,
_schema
:
source
.
_schema
,
_schema
:
source
.
_schema
,
_schemaDelimiter
:
source
.
_schemaDelimiter
_schemaDelimiter
:
source
.
_schemaDelimiter
...
...
lib/dialects/postgres/query.js
View file @
6d19ea2
...
@@ -57,7 +57,7 @@ class Query extends AbstractQuery {
...
@@ -57,7 +57,7 @@ class Query extends AbstractQuery {
this
.
sql
=
sql
;
this
.
sql
=
sql
;
if
(
!
Utils
.
_
.
isEmpty
(
this
.
options
.
searchPath
))
{
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
const
query
=
parameters
&&
parameters
.
length
...
@@ -129,7 +129,7 @@ class Query extends AbstractQuery {
...
@@ -129,7 +129,7 @@ class Query extends AbstractQuery {
// Map column index in table to column name
// Map column index in table to column name
const
columns
=
_
.
zipObject
(
const
columns
=
_
.
zipObject
(
row
.
column_indexes
,
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_indexes
;
delete
row
.
column_names
;
delete
row
.
column_names
;
...
@@ -203,7 +203,7 @@ class Query extends AbstractQuery {
...
@@ -203,7 +203,7 @@ class Query extends AbstractQuery {
type
:
row
.
Type
.
toUpperCase
(),
type
:
row
.
Type
.
toUpperCase
(),
allowNull
:
row
.
Null
===
'YES'
,
allowNull
:
row
.
Null
===
'YES'
,
defaultValue
:
row
.
Default
,
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'
primaryKey
:
row
.
Constraint
===
'PRIMARY KEY'
};
};
...
...
lib/sequelize.js
View file @
6d19ea2
...
@@ -224,10 +224,12 @@ class Sequelize {
...
@@ -224,10 +224,12 @@ class Sequelize {
default
:
default
:
throw
new
Error
(
'The dialect '
+
this
.
getDialect
()
+
' is not supported. Supported dialects: mssql, mysql, postgres, and sqlite.'
);
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
.
dialect
.
QueryGenerator
.
typeValidation
=
options
.
typeValidation
;
this
.
queryInterface
=
new
QueryInterface
(
this
);
/**
/**
* Models are stored here under the name given to `sequelize.define`
* Models are stored here under the name given to `sequelize.define`
*/
*/
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment