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 3ccca4a3
authored
Jan 27, 2015
by
Mick Hansen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2988 from ThankYouMotion/mssqlUUID
UUID datatype mapping for mssql
2 parents
2cb214b6
81250283
Show 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 @
3ccca4a
...
...
@@ -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 @
3ccca4a
...
...
@@ -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 @
3ccca4a
...
...
@@ -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 @
3ccca4a
...
...
@@ -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 @
3ccca4a
...
...
@@ -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