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 1dfb1ebd
authored
Feb 16, 2015
by
Dr. Evil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixes following to PR discussion
1 parent
57b54c4b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
15 deletions
lib/data-types.js
test/integration/dialects/postgres/dao.test.js
test/integration/dialects/postgres/error.test.js
lib/data-types.js
View file @
1dfb1eb
...
@@ -410,7 +410,7 @@ var pgRangeSubtypes = {
...
@@ -410,7 +410,7 @@ var pgRangeSubtypes = {
RANGE
.
prototype
.
key
=
RANGE
.
key
=
'RANGE'
;
RANGE
.
prototype
.
key
=
RANGE
.
key
=
'RANGE'
;
RANGE
.
prototype
.
toSql
=
function
()
{
RANGE
.
prototype
.
toSql
=
function
()
{
return
pgRangeSubtypes
[
this
.
_subtype
.
toLowerCase
()]
||
pgRangeSubtypes
[
'integer'
]
;
return
pgRangeSubtypes
[
this
.
_subtype
.
toLowerCase
()];
};
};
/**
/**
...
@@ -510,7 +510,7 @@ ENUM.prototype.key = ENUM.key = 'ENUM';
...
@@ -510,7 +510,7 @@ ENUM.prototype.key = ENUM.key = 'ENUM';
* @property ARRAY
* @property ARRAY
*/
*/
var
ARRAY
=
function
(
type
)
{
var
ARRAY
=
function
(
type
)
{
var
options
=
_
.
isPlainObject
(
type
)
&&
!
(
type
instanceof
ABSTRACT
)
&&
type
||
{
var
options
=
_
.
isPlainObject
(
type
)
?
type
:
{
type
:
type
type
:
type
};
};
if
(
!
(
this
instanceof
ARRAY
))
return
new
ARRAY
(
options
);
if
(
!
(
this
instanceof
ARRAY
))
return
new
ARRAY
(
options
);
...
...
test/integration/dialects/postgres/dao.test.js
View file @
1dfb1eb
...
@@ -696,13 +696,13 @@ if (dialect.match(/^postgres/)) {
...
@@ -696,13 +696,13 @@ if (dialect.match(/^postgres/)) {
it
(
'should bulkCreate with range property'
,
function
()
{
it
(
'should bulkCreate with range property'
,
function
()
{
var
User
=
this
.
User
,
var
User
=
this
.
User
,
period
=
[
new
Date
(
2015
,
0
,
1
),
new
Date
(
2015
,
11
,
31
)];
period
=
[
new
Date
(
2015
,
0
,
1
),
new
Date
(
2015
,
11
,
31
)];
return
this
.
User
.
bulkCreate
([{
return
this
.
User
.
bulkCreate
([{
username
:
'bob'
,
username
:
'bob'
,
email
:
[
'myemail@email.com'
],
email
:
[
'myemail@email.com'
],
course_period
:
period
course_period
:
period
}]).
then
(
function
()
{
}]).
then
(
function
()
{
return
User
.
find
(
1
).
then
(
function
(
user
)
{
return
User
.
find
(
1
).
then
(
function
(
user
)
{
expect
(
user
.
course_period
[
0
]
instanceof
Date
).
to
.
be
.
ok
;
expect
(
user
.
course_period
[
0
]
instanceof
Date
).
to
.
be
.
ok
;
expect
(
user
.
course_period
[
1
]
instanceof
Date
).
to
.
be
.
ok
;
expect
(
user
.
course_period
[
1
]
instanceof
Date
).
to
.
be
.
ok
;
...
@@ -715,7 +715,7 @@ if (dialect.match(/^postgres/)) {
...
@@ -715,7 +715,7 @@ if (dialect.match(/^postgres/)) {
it
(
'should update range correctly'
,
function
()
{
it
(
'should update range correctly'
,
function
()
{
var
self
=
this
,
var
self
=
this
,
period
=
[
new
Date
(
2015
,
0
,
1
),
new
Date
(
2015
,
11
,
31
)];
period
=
[
new
Date
(
2015
,
0
,
1
),
new
Date
(
2015
,
11
,
31
)];
return
this
.
User
.
create
({
username
:
'user'
,
email
:
[
'foo@bar.com'
],
course_period
:
period
}).
then
(
function
(
newUser
)
{
return
this
.
User
.
create
({
username
:
'user'
,
email
:
[
'foo@bar.com'
],
course_period
:
period
}).
then
(
function
(
newUser
)
{
// Check to see if the default value for a range field works
// Check to see if the default value for a range field works
...
@@ -746,7 +746,7 @@ if (dialect.match(/^postgres/)) {
...
@@ -746,7 +746,7 @@ if (dialect.match(/^postgres/)) {
it
(
'should update range correctly and return the affected rows'
,
function
()
{
it
(
'should update range correctly and return the affected rows'
,
function
()
{
var
self
=
this
,
var
self
=
this
,
period
=
[
new
Date
(
2015
,
1
,
1
),
new
Date
(
2015
,
10
,
30
)];
period
=
[
new
Date
(
2015
,
1
,
1
),
new
Date
(
2015
,
10
,
30
)];
return
this
.
User
.
create
({
username
:
'user'
,
email
:
[
'foo@bar.com'
],
course_period
:
[
new
Date
(
2015
,
0
,
1
),
new
Date
(
2015
,
11
,
31
)]}).
then
(
function
(
oldUser
)
{
return
this
.
User
.
create
({
username
:
'user'
,
email
:
[
'foo@bar.com'
],
course_period
:
[
new
Date
(
2015
,
0
,
1
),
new
Date
(
2015
,
11
,
31
)]}).
then
(
function
(
oldUser
)
{
// Update the user and check that the returned object's fields have been parsed by the range parser
// Update the user and check that the returned object's fields have been parsed by the range parser
...
...
test/integration/dialects/postgres/error.test.js
View file @
1dfb1eb
...
@@ -55,16 +55,12 @@ if (dialect.match(/^postgres/)) {
...
@@ -55,16 +55,12 @@ if (dialect.match(/^postgres/)) {
period
:
[
new
Date
(
2015
,
0
,
1
),
new
Date
(
2015
,
0
,
3
)]
period
:
[
new
Date
(
2015
,
0
,
1
),
new
Date
(
2015
,
0
,
3
)]
})
})
.
then
(
function
()
{
.
then
(
function
()
{
return
Booking
return
expect
(
Booking
.
create
({
.
create
({
roomNo
:
1
,
roomNo
:
1
,
guestName
:
'Frequent Visitor'
,
guestName
:
'Frequent Visitor'
,
period
:
[
new
Date
(
2015
,
0
,
2
),
new
Date
(
2015
,
0
,
5
)]
period
:
[
new
Date
(
2015
,
0
,
2
),
new
Date
(
2015
,
0
,
5
)]
})
})).
to
.
eventually
.
be
.
rejectedWith
(
Sequelize
.
ExclusionConstraintError
);
.
done
(
function
(
err
)
{
expect
(
!!
err
).
to
.
be
.
ok
;
expect
(
err
instanceof
Sequelize
.
ExclusionConstraintError
).
to
.
be
.
ok
;
});
});
});
});
});
...
...
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