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 81250283
authored
Jan 22, 2015
by
Nicolas Silberman
Committed by
vvo
Jan 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UUID datatype mapping for mssql dialect
See #2988 for details
1 parent
6a0912ad
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
8 deletions
lib/dialects/mssql/data-types.js
lib/dialects/mssql/query-generator.js
test/integration/associations/belongs-to-many.test.js
test/integration/associations/has-many.test.js
test/integration/instance.test.js
lib/dialects/mssql/data-types.js
View file @
8125028
...
...
@@ -5,7 +5,7 @@ var DataTypes = require('../../data-types');
//drop table Group
DataTypes
.
BOOLEAN
=
'BIT'
;
DataTypes
.
NOW
=
'GETDATE()'
;
DataTypes
.
UUID
=
'
UNIQUEIDENTIFIER
'
;
DataTypes
.
UUID
=
'
CHAR(36)
'
;
DataTypes
.
BLOB
=
'VARBINARY(MAX)'
;
DataTypes
.
STRING
.
_typeName
=
'NVARCHAR'
;
...
...
lib/dialects/mssql/query-generator.js
View file @
8125028
...
...
@@ -621,6 +621,10 @@ module.exports = (function() {
dataType
=
dataType
.
replace
(
/BLOB/
,
'VARBINARY(MAX)'
);
}
if
(
Utils
.
_
.
includes
(
dataType
,
'UUID'
))
{
dataType
=
dataType
.
replace
(
/UUID/
,
DataTypes
.
UUID
);
}
return
dataType
;
}
...
...
test/integration/associations/belongs-to-many.test.js
View file @
8125028
...
...
@@ -727,7 +727,8 @@ describe(Support.getTestDialectTeaser('BelongsToMany'), function() {
var
Beacons
=
this
.
sequelize
.
define
(
'Beacon'
,
{
id
:
{
primaryKey
:
true
,
type
:
DataTypes
.
UUID
type
:
DataTypes
.
UUID
,
defaultValue
:
DataTypes
.
UUIDV4
},
name
:
{
type
:
DataTypes
.
STRING
...
...
test/integration/associations/has-many.test.js
View file @
8125028
...
...
@@ -1485,7 +1485,8 @@ describe(Support.getTestDialectTeaser('HasMany'), function() {
var
Beacons
=
this
.
sequelize
.
define
(
'Beacon'
,
{
id
:
{
primaryKey
:
true
,
type
:
DataTypes
.
UUID
type
:
DataTypes
.
UUID
,
defaultValue
:
DataTypes
.
UUIDV4
},
name
:
{
type
:
DataTypes
.
STRING
...
...
test/integration/instance.test.js
View file @
8125028
...
...
@@ -1754,11 +1754,6 @@ describe(Support.getTestDialectTeaser('Instance'), function() {
var
query
=
{
where
:
{
username
:
'fnord'
}};
self
.
User
.
find
(
query
).
success
(
function
(
user2
)
{
if
(
dialect
===
'mssql'
)
{
user1
.
dataValues
.
uuidv1
=
user1
.
dataValues
.
uuidv1
.
toUpperCase
();
user1
.
dataValues
.
uuidv4
=
user1
.
dataValues
.
uuidv4
.
toUpperCase
();
}
expect
(
user1
.
equals
(
user2
)).
to
.
be
.
true
;
done
();
});
...
...
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