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 d98d8bd8
authored
Jan 08, 2018
by
Sushant
Committed by
GitHub
Jan 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: base type wont work after ENUM model is synced (#8851)
1 parent
bf7a55ba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
6 deletions
lib/query-interface.js
test/integration/data-types.test.js
test/integration/dialects/postgres/regressions.test.js
lib/query-interface.js
View file @
d98d8bd
...
...
@@ -255,10 +255,7 @@ class QueryInterface {
.
tap
(()
=>
{
// If ENUM processed, then refresh OIDs
if
(
promises
.
length
)
{
return
this
.
sequelize
.
dialect
.
connectionManager
.
_refreshDynamicOIDs
()
.
then
(()
=>
{
return
this
.
sequelize
.
refreshTypes
(
DataTypes
.
postgres
);
});
return
this
.
sequelize
.
dialect
.
connectionManager
.
_refreshDynamicOIDs
();
}
})
.
then
(()
=>
{
...
...
test/integration/data-types.test.js
View file @
d98d8bd
...
...
@@ -87,8 +87,6 @@ describe(Support.getTestDialectTeaser('DataTypes'), () => {
return
Sequelize
.
ABSTRACT
.
prototype
.
stringify
.
apply
(
this
,
arguments
);
});
current
.
refreshTypes
();
const
User
=
current
.
define
(
'user'
,
{
field
:
Type
},
{
...
...
@@ -96,6 +94,9 @@ describe(Support.getTestDialectTeaser('DataTypes'), () => {
});
return
current
.
sync
({
force
:
true
}).
then
(()
=>
{
current
.
refreshTypes
();
return
User
.
create
({
field
:
value
});
...
...
test/integration/dialects/postgres/regressions.test.js
0 → 100644
View file @
d98d8bd
'use strict'
;
const
chai
=
require
(
'chai'
),
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../../support'
),
Sequelize
=
Support
.
Sequelize
,
dialect
=
Support
.
getTestDialect
();
if
(
dialect
.
match
(
/^postgres/
))
{
describe
(
'[POSTGRES Specific] Regressions'
,
()
=>
{
it
(
'properly fetch OIDs after sync, #8749'
,
function
()
{
const
User
=
this
.
sequelize
.
define
(
'User'
,
{
active
:
Sequelize
.
BOOLEAN
});
/**
* This Model is important, sync will try to fetch OIDs after each ENUM model sync
* Having ENUM in this model will force OIDs re-fetch
* We are testing that OID refresh keep base type intact
*/
const
Media
=
this
.
sequelize
.
define
(
'Media'
,
{
type
:
Sequelize
.
ENUM
([
'image'
,
'video'
,
'audio'
])
});
User
.
hasMany
(
Media
);
Media
.
belongsTo
(
User
);
return
this
.
sequelize
.
sync
({
force
:
true
})
.
then
(()
=>
User
.
create
({
active
:
true
}))
.
then
(
user
=>
{
expect
(
user
.
active
).
to
.
be
.
true
;
expect
(
user
.
get
(
'active'
)).
to
.
be
.
true
;
return
User
.
findOne
();
})
.
then
(
user
=>
{
expect
(
user
.
active
).
to
.
be
.
true
;
expect
(
user
.
get
(
'active'
)).
to
.
be
.
true
;
return
User
.
findOne
({
raw
:
true
});
})
.
then
(
user
=>
{
expect
(
user
.
active
).
to
.
be
.
true
;
});
});
});
}
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