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 ded97557
authored
Oct 10, 2018
by
ugogiordano87
Committed by
Sushant
Oct 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(data-types): remove unsupported integer modifiers (#10001)
1 parent
8a8366b4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
97 deletions
lib/dialects/postgres/data-types.js
lib/dialects/sqlite/data-types.js
lib/dialects/sqlite/query-generator.js
test/unit/dialects/sqlite/query-generator.test.js
test/unit/sql/data-types.test.js
lib/dialects/postgres/data-types.js
View file @
ded9755
...
...
@@ -8,6 +8,20 @@ module.exports = BaseTypes => {
const
warn
=
BaseTypes
.
ABSTRACT
.
warn
.
bind
(
undefined
,
'http://www.postgresql.org/docs/9.4/static/datatype.html'
);
/**
* Removes unsupported Postgres options, i.e., LENGTH, UNSIGNED and ZEROFILL, for the integer data types.
* @param dataType The base integer data type.
*/
function
removeUnsupportedIntegerOptions
(
dataType
)
{
if
(
dataType
.
_length
||
dataType
.
options
.
length
||
dataType
.
_unsigned
||
dataType
.
_zerofill
)
{
warn
(
'PostgresSQL does not support '
+
dataType
.
_name
+
' with LENGTH, UNSIGNED or ZEROFILL. Plain `'
+
dataType
.
_name
+
'` will be used instead.'
);
dataType
.
_length
=
undefined
;
dataType
.
options
.
length
=
undefined
;
dataType
.
_unsigned
=
undefined
;
dataType
.
_zerofill
=
undefined
;
}
}
/**
* types:
* {
* oids: [oid],
...
...
@@ -55,6 +69,7 @@ module.exports = BaseTypes => {
if
(
!
(
this
instanceof
DATEONLY
))
return
new
DATEONLY
();
BaseTypes
.
DATEONLY
.
apply
(
this
,
arguments
);
}
inherits
(
DATEONLY
,
BaseTypes
.
DATEONLY
);
DATEONLY
.
parse
=
function
parse
(
value
)
{
...
...
@@ -102,6 +117,7 @@ module.exports = BaseTypes => {
if
(
!
(
this
instanceof
DECIMAL
))
return
new
DECIMAL
(
precision
,
scale
);
BaseTypes
.
DECIMAL
.
apply
(
this
,
arguments
);
}
inherits
(
DECIMAL
,
BaseTypes
.
DECIMAL
);
DECIMAL
.
parse
=
function
parse
(
value
)
{
...
...
@@ -258,14 +274,7 @@ module.exports = BaseTypes => {
if
(
!
(
this
instanceof
TINYINT
))
return
new
TINYINT
(
length
);
BaseTypes
.
TINYINT
.
apply
(
this
,
arguments
);
// POSTGRES does not support any parameters for tinyint
if
(
this
.
_length
||
this
.
options
.
length
||
this
.
_unsigned
||
this
.
_zerofill
)
{
warn
(
'PostgreSQL does not support TINYINT with options. Plain `TINYINT` will be used instead.'
);
this
.
_length
=
undefined
;
this
.
options
.
length
=
undefined
;
this
.
_unsigned
=
undefined
;
this
.
_zerofill
=
undefined
;
}
removeUnsupportedIntegerOptions
(
this
);
}
inherits
(
TINYINT
,
BaseTypes
.
TINYINT
);
...
...
@@ -279,14 +288,7 @@ module.exports = BaseTypes => {
if
(
!
(
this
instanceof
SMALLINT
))
return
new
SMALLINT
(
length
);
BaseTypes
.
SMALLINT
.
apply
(
this
,
arguments
);
// POSTGRES does not support any parameters for bigint
if
(
this
.
_length
||
this
.
options
.
length
||
this
.
_unsigned
||
this
.
_zerofill
)
{
warn
(
'PostgreSQL does not support SMALLINT with options. Plain `SMALLINT` will be used instead.'
);
this
.
_length
=
undefined
;
this
.
options
.
length
=
undefined
;
this
.
_unsigned
=
undefined
;
this
.
_zerofill
=
undefined
;
}
removeUnsupportedIntegerOptions
(
this
);
}
inherits
(
SMALLINT
,
BaseTypes
.
SMALLINT
);
...
...
@@ -300,14 +302,7 @@ module.exports = BaseTypes => {
if
(
!
(
this
instanceof
INTEGER
))
return
new
INTEGER
(
length
);
BaseTypes
.
INTEGER
.
apply
(
this
,
arguments
);
// POSTGRES does not support any parameters for integer
if
(
this
.
_length
||
this
.
options
.
length
||
this
.
_unsigned
||
this
.
_zerofill
)
{
warn
(
'PostgreSQL does not support INTEGER with options. Plain `INTEGER` will be used instead.'
);
this
.
_length
=
undefined
;
this
.
options
.
length
=
undefined
;
this
.
_unsigned
=
undefined
;
this
.
_zerofill
=
undefined
;
}
removeUnsupportedIntegerOptions
(
this
);
}
inherits
(
INTEGER
,
BaseTypes
.
INTEGER
);
...
...
@@ -325,14 +320,7 @@ module.exports = BaseTypes => {
if
(
!
(
this
instanceof
BIGINT
))
return
new
BIGINT
(
length
);
BaseTypes
.
BIGINT
.
apply
(
this
,
arguments
);
// POSTGRES does not support any parameters for bigint
if
(
this
.
_length
||
this
.
options
.
length
||
this
.
_unsigned
||
this
.
_zerofill
)
{
warn
(
'PostgreSQL does not support BIGINT with options. Plain `BIGINT` will be used instead.'
);
this
.
_length
=
undefined
;
this
.
options
.
length
=
undefined
;
this
.
_unsigned
=
undefined
;
this
.
_zerofill
=
undefined
;
}
removeUnsupportedIntegerOptions
(
this
);
}
inherits
(
BIGINT
,
BaseTypes
.
BIGINT
);
...
...
@@ -346,14 +334,7 @@ module.exports = BaseTypes => {
if
(
!
(
this
instanceof
REAL
))
return
new
REAL
(
length
,
decimals
);
BaseTypes
.
REAL
.
apply
(
this
,
arguments
);
// POSTGRES does not support any parameters for real
if
(
this
.
_length
||
this
.
options
.
length
||
this
.
_unsigned
||
this
.
_zerofill
)
{
warn
(
'PostgreSQL does not support REAL with options. Plain `REAL` will be used instead.'
);
this
.
_length
=
undefined
;
this
.
options
.
length
=
undefined
;
this
.
_unsigned
=
undefined
;
this
.
_zerofill
=
undefined
;
}
removeUnsupportedIntegerOptions
(
this
);
}
inherits
(
REAL
,
BaseTypes
.
REAL
);
...
...
@@ -367,14 +348,7 @@ module.exports = BaseTypes => {
if
(
!
(
this
instanceof
DOUBLE
))
return
new
DOUBLE
(
length
,
decimals
);
BaseTypes
.
DOUBLE
.
apply
(
this
,
arguments
);
// POSTGRES does not support any parameters for double
if
(
this
.
_length
||
this
.
options
.
length
||
this
.
_unsigned
||
this
.
_zerofill
)
{
warn
(
'PostgreSQL does not support DOUBLE with options. Plain `DOUBLE` will be used instead.'
);
this
.
_length
=
undefined
;
this
.
options
.
length
=
undefined
;
this
.
_unsigned
=
undefined
;
this
.
_zerofill
=
undefined
;
}
removeUnsupportedIntegerOptions
(
this
);
}
inherits
(
DOUBLE
,
BaseTypes
.
DOUBLE
);
...
...
@@ -426,7 +400,7 @@ module.exports = BaseTypes => {
BLOB
.
prototype
.
_hexify
=
function
_hexify
(
hex
)
{
// bytea hex format http://www.postgresql.org/docs/current/static/datatype-binary.html
return
"E'\\\\x"
+
hex
+
"'"
;
return
'E\'\\\\x'
+
hex
+
'\''
;
};
BaseTypes
.
BLOB
.
types
.
postgres
=
{
...
...
@@ -513,6 +487,7 @@ module.exports = BaseTypes => {
};
let
hstore
;
function
HSTORE
()
{
if
(
!
(
this
instanceof
HSTORE
))
return
new
HSTORE
();
BaseTypes
.
HSTORE
.
apply
(
this
,
arguments
);
...
...
lib/dialects/sqlite/data-types.js
View file @
ded9755
...
...
@@ -7,6 +7,18 @@ module.exports = BaseTypes => {
const
warn
=
BaseTypes
.
ABSTRACT
.
warn
.
bind
(
undefined
,
'https://www.sqlite.org/datatype3.html'
);
/**
* Removes unsupported SQLite options, i.e., UNSIGNED and ZEROFILL, for the integer data types.
* @param dataType The base integer data type.
*/
function
removeUnsupportedIntegerOptions
(
dataType
)
{
if
(
dataType
.
_zerofill
||
dataType
.
_unsigned
)
{
warn
(
'SQLite does not support '
+
dataType
.
_name
+
' with UNSIGNED or ZEROFILL. Plain `'
+
dataType
.
_name
+
'` will be used instead.'
);
dataType
.
_unsigned
=
undefined
;
dataType
.
_zerofill
=
undefined
;
}
}
/**
* @see https://sqlite.org/datatype3.html
*/
...
...
@@ -138,6 +150,8 @@ module.exports = BaseTypes => {
function
TINYINT
(
length
)
{
if
(
!
(
this
instanceof
TINYINT
))
return
new
TINYINT
(
length
);
BaseTypes
.
TINYINT
.
apply
(
this
,
arguments
);
removeUnsupportedIntegerOptions
(
this
);
}
inherits
(
TINYINT
,
BaseTypes
.
TINYINT
);
...
...
@@ -148,6 +162,8 @@ module.exports = BaseTypes => {
function
SMALLINT
(
length
)
{
if
(
!
(
this
instanceof
SMALLINT
))
return
new
SMALLINT
(
length
);
BaseTypes
.
SMALLINT
.
apply
(
this
,
arguments
);
removeUnsupportedIntegerOptions
(
this
);
}
inherits
(
SMALLINT
,
BaseTypes
.
SMALLINT
);
...
...
@@ -158,6 +174,8 @@ module.exports = BaseTypes => {
function
MEDIUMINT
(
length
)
{
if
(
!
(
this
instanceof
MEDIUMINT
))
return
new
MEDIUMINT
(
length
);
BaseTypes
.
MEDIUMINT
.
apply
(
this
,
arguments
);
removeUnsupportedIntegerOptions
(
this
);
}
inherits
(
MEDIUMINT
,
BaseTypes
.
MEDIUMINT
);
...
...
@@ -168,6 +186,8 @@ module.exports = BaseTypes => {
function
INTEGER
(
length
)
{
if
(
!
(
this
instanceof
INTEGER
))
return
new
INTEGER
(
length
);
BaseTypes
.
INTEGER
.
apply
(
this
,
arguments
);
removeUnsupportedIntegerOptions
(
this
);
}
inherits
(
INTEGER
,
BaseTypes
.
INTEGER
);
...
...
@@ -178,6 +198,8 @@ module.exports = BaseTypes => {
function
BIGINT
(
length
)
{
if
(
!
(
this
instanceof
BIGINT
))
return
new
BIGINT
(
length
);
BaseTypes
.
BIGINT
.
apply
(
this
,
arguments
);
removeUnsupportedIntegerOptions
(
this
);
}
inherits
(
BIGINT
,
BaseTypes
.
BIGINT
);
...
...
lib/dialects/sqlite/query-generator.js
View file @
ded9755
...
...
@@ -29,19 +29,15 @@ class SQLiteQueryGenerator extends MySqlQueryGenerator {
for
(
const
attr
in
attributes
)
{
if
(
attributes
.
hasOwnProperty
(
attr
))
{
le
t
dataType
=
attributes
[
attr
];
cons
t
dataType
=
attributes
[
attr
];
const
containsAutoIncrement
=
_
.
includes
(
dataType
,
'AUTOINCREMENT'
);
if
(
containsAutoIncrement
)
{
dataType
=
dataType
.
replace
(
/BIGINT/
,
'INTEGER'
);
}
let
dataTypeString
=
dataType
;
if
(
_
.
includes
(
dataType
,
'PRIMARY KEY'
))
{
if
(
_
.
includes
(
dataType
,
'INT
EGER
'
))
{
if
(
_
.
includes
(
dataType
,
'INT'
))
{
// Only INTEGER is allowed for primary key, see https://github.com/sequelize/sequelize/issues/969 (no lenght, unsigned etc)
dataTypeString
=
containsAutoIncrement
?
'INTEGER PRIMARY KEY AUTOINCREMENT'
:
'INTEGER PRIMARY KEY'
;
if
(
_
.
includes
(
dataType
,
' REFERENCES'
))
{
dataTypeString
+=
dataType
.
substr
(
dataType
.
indexOf
(
' REFERENCES'
));
}
...
...
@@ -199,7 +195,7 @@ class SQLiteQueryGenerator extends MySqlQueryGenerator {
}
showTablesQuery
()
{
return
"SELECT name FROM `sqlite_master` WHERE type='table' and name!='sqlite_sequence';"
;
return
'SELECT name FROM `sqlite_master` WHERE type=\'table\' and name!=\'sqlite_sequence\';'
;
}
upsertQuery
(
tableName
,
insertValues
,
updateValues
,
where
,
model
,
options
)
{
...
...
@@ -348,7 +344,7 @@ class SQLiteQueryGenerator extends MySqlQueryGenerator {
}
showConstraintsQuery
(
tableName
,
constraintName
)
{
let
sql
=
`SELECT sql FROM sqlite_master WHERE tbl_name='
${
tableName
}
'`
;
let
sql
=
`SELECT sql FROM sqlite_master WHERE tbl_name='
${
tableName
}
'`
;
if
(
constraintName
)
{
sql
+=
` AND sql LIKE '%
${
constraintName
}
%'`
;
...
...
@@ -477,7 +473,7 @@ class SQLiteQueryGenerator extends MySqlQueryGenerator {
case
Transaction
.
ISOLATION_LEVELS
.
READ_COMMITTED
:
return
'PRAGMA read_uncommitted = OFF;'
;
case
Transaction
.
ISOLATION_LEVELS
.
SERIALIZABLE
:
return
"-- SQLite's default isolation level is SERIALIZABLE. Nothing to do."
;
return
'-- SQLite\'s default isolation level is SERIALIZABLE. Nothing to do.'
;
default
:
throw
new
Error
(
'Unknown isolation level: '
+
value
);
}
...
...
test/unit/dialects/sqlite/query-generator.test.js
View file @
ded9755
...
...
@@ -142,6 +142,14 @@ if (dialect === 'sqlite') {
expectation
:
'CREATE TABLE IF NOT EXISTS `myTable` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` VARCHAR(255));'
},
{
arguments
:
[
'myTable'
,
{
id
:
'INTEGER(4) PRIMARY KEY AUTOINCREMENT'
,
name
:
'VARCHAR(255)'
}],
expectation
:
'CREATE TABLE IF NOT EXISTS `myTable` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` VARCHAR(255));'
},
{
arguments
:
[
'myTable'
,
{
id
:
'SMALLINT(4) PRIMARY KEY AUTOINCREMENT UNSIGNED'
,
name
:
'VARCHAR(255)'
}],
expectation
:
'CREATE TABLE IF NOT EXISTS `myTable` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` VARCHAR(255));'
},
{
arguments
:
[
'myTable'
,
{
id
:
'INTEGER PRIMARY KEY AUTOINCREMENT'
,
name
:
'VARCHAR(255)'
,
surname
:
'VARCHAR(255)'
},
{
uniqueKeys
:
{
uniqueConstraint
:
{
fields
:
[
'name'
,
'surname'
],
customIndex
:
true
}}}],
expectation
:
'CREATE TABLE IF NOT EXISTS `myTable` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` VARCHAR(255), `surname` VARCHAR(255), UNIQUE (`name`, `surname`));'
}
...
...
test/unit/sql/data-types.test.js
View file @
ded9755
'use strict'
;
const
Support
=
require
(
'../support'
),
const
Support
=
require
(
'../support'
),
DataTypes
=
require
(
'../../../lib/data-types'
),
Sequelize
=
Support
.
Sequelize
,
chai
=
require
(
'chai'
),
util
=
require
(
'util'
),
uuid
=
require
(
'uuid'
),
expectsql
=
Support
.
expectsql
,
current
=
Support
.
sequelize
,
current
=
Support
.
sequelize
,
expect
=
chai
.
expect
;
// Notice: [] will be replaced by dialect specific tick/quote character when there is not dialect specific expectation but only a default expectation
...
...
@@ -331,13 +331,15 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
testsql
(
'INTEGER.UNSIGNED'
,
DataTypes
.
INTEGER
.
UNSIGNED
,
{
default
:
'INTEGER UNSIGNED'
,
postgres
:
'INTEGER'
,
mssql
:
'INTEGER'
mssql
:
'INTEGER'
,
sqlite
:
'INTEGER'
});
testsql
(
'INTEGER.UNSIGNED.ZEROFILL'
,
DataTypes
.
INTEGER
.
UNSIGNED
.
ZEROFILL
,
{
default
:
'INTEGER UNSIGNED ZEROFILL'
,
postgres
:
'INTEGER'
,
mssql
:
'INTEGER'
mssql
:
'INTEGER'
,
sqlite
:
'INTEGER'
});
testsql
(
'INTEGER(11)'
,
DataTypes
.
INTEGER
(
11
),
{
...
...
@@ -354,28 +356,28 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
testsql
(
'INTEGER(11).UNSIGNED'
,
DataTypes
.
INTEGER
(
11
).
UNSIGNED
,
{
default
:
'INTEGER(11) UNSIGNED'
,
sqlite
:
'INTEGER
UNSIGNED
(11)'
,
sqlite
:
'INTEGER(11)'
,
postgres
:
'INTEGER'
,
mssql
:
'INTEGER'
});
testsql
(
'INTEGER(11).UNSIGNED.ZEROFILL'
,
DataTypes
.
INTEGER
(
11
).
UNSIGNED
.
ZEROFILL
,
{
default
:
'INTEGER(11) UNSIGNED ZEROFILL'
,
sqlite
:
'INTEGER
UNSIGNED ZEROFILL
(11)'
,
sqlite
:
'INTEGER(11)'
,
postgres
:
'INTEGER'
,
mssql
:
'INTEGER'
});
testsql
(
'INTEGER(11).ZEROFILL'
,
DataTypes
.
INTEGER
(
11
).
ZEROFILL
,
{
default
:
'INTEGER(11) ZEROFILL'
,
sqlite
:
'INTEGER
ZEROFILL
(11)'
,
sqlite
:
'INTEGER(11)'
,
postgres
:
'INTEGER'
,
mssql
:
'INTEGER'
});
testsql
(
'INTEGER(11).ZEROFILL.UNSIGNED'
,
DataTypes
.
INTEGER
(
11
).
ZEROFILL
.
UNSIGNED
,
{
default
:
'INTEGER(11) UNSIGNED ZEROFILL'
,
sqlite
:
'INTEGER
UNSIGNED ZEROFILL
(11)'
,
sqlite
:
'INTEGER(11)'
,
postgres
:
'INTEGER'
,
mssql
:
'INTEGER'
});
...
...
@@ -439,7 +441,8 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
expect
:
{
default
:
'TINYINT UNSIGNED'
,
mssql
:
'TINYINT'
,
postgres
:
'TINYINT'
postgres
:
'TINYINT'
,
sqlite
:
'TINYINT'
}
},
{
...
...
@@ -447,7 +450,7 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
TINYINT
(
2
).
UNSIGNED
,
expect
:
{
default
:
'TINYINT(2) UNSIGNED'
,
sqlite
:
'TINYINT
UNSIGNED
(2)'
,
sqlite
:
'TINYINT(2)'
,
mssql
:
'TINYINT'
,
postgres
:
'TINYINT'
}
...
...
@@ -458,7 +461,8 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
expect
:
{
default
:
'TINYINT UNSIGNED ZEROFILL'
,
mssql
:
'TINYINT'
,
postgres
:
'TINYINT'
postgres
:
'TINYINT'
,
sqlite
:
'TINYINT'
}
},
{
...
...
@@ -466,7 +470,7 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
TINYINT
(
2
).
UNSIGNED
.
ZEROFILL
,
expect
:
{
default
:
'TINYINT(2) UNSIGNED ZEROFILL'
,
sqlite
:
'TINYINT
UNSIGNED ZEROFILL
(2)'
,
sqlite
:
'TINYINT(2)'
,
mssql
:
'TINYINT'
,
postgres
:
'TINYINT'
}
...
...
@@ -477,7 +481,8 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
expect
:
{
default
:
'TINYINT ZEROFILL'
,
mssql
:
'TINYINT'
,
postgres
:
'TINYINT'
postgres
:
'TINYINT'
,
sqlite
:
'TINYINT'
}
},
{
...
...
@@ -485,7 +490,7 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
TINYINT
(
2
).
ZEROFILL
,
expect
:
{
default
:
'TINYINT(2) ZEROFILL'
,
sqlite
:
'TINYINT
ZEROFILL
(2)'
,
sqlite
:
'TINYINT(2)'
,
mssql
:
'TINYINT'
,
postgres
:
'TINYINT'
}
...
...
@@ -496,7 +501,8 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
expect
:
{
default
:
'TINYINT UNSIGNED ZEROFILL'
,
mssql
:
'TINYINT'
,
postgres
:
'TINYINT'
postgres
:
'TINYINT'
,
sqlite
:
'TINYINT'
}
},
{
...
...
@@ -504,7 +510,7 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
TINYINT
(
2
).
ZEROFILL
.
UNSIGNED
,
expect
:
{
default
:
'TINYINT(2) UNSIGNED ZEROFILL'
,
sqlite
:
'TINYINT
UNSIGNED ZEROFILL
(2)'
,
sqlite
:
'TINYINT(2)'
,
mssql
:
'TINYINT'
,
postgres
:
'TINYINT'
}
...
...
@@ -569,7 +575,8 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
expect
:
{
default
:
'SMALLINT UNSIGNED'
,
postgres
:
'SMALLINT'
,
mssql
:
'SMALLINT'
mssql
:
'SMALLINT'
,
sqlite
:
'SMALLINT'
}
},
{
...
...
@@ -577,7 +584,7 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
SMALLINT
(
4
).
UNSIGNED
,
expect
:
{
default
:
'SMALLINT(4) UNSIGNED'
,
sqlite
:
'SMALLINT
UNSIGNED
(4)'
,
sqlite
:
'SMALLINT(4)'
,
postgres
:
'SMALLINT'
,
mssql
:
'SMALLINT'
}
...
...
@@ -588,7 +595,8 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
expect
:
{
default
:
'SMALLINT UNSIGNED ZEROFILL'
,
postgres
:
'SMALLINT'
,
mssql
:
'SMALLINT'
mssql
:
'SMALLINT'
,
sqlite
:
'SMALLINT'
}
},
{
...
...
@@ -596,7 +604,7 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
SMALLINT
(
4
).
UNSIGNED
.
ZEROFILL
,
expect
:
{
default
:
'SMALLINT(4) UNSIGNED ZEROFILL'
,
sqlite
:
'SMALLINT
UNSIGNED ZEROFILL
(4)'
,
sqlite
:
'SMALLINT(4)'
,
postgres
:
'SMALLINT'
,
mssql
:
'SMALLINT'
}
...
...
@@ -607,7 +615,8 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
expect
:
{
default
:
'SMALLINT ZEROFILL'
,
postgres
:
'SMALLINT'
,
mssql
:
'SMALLINT'
mssql
:
'SMALLINT'
,
sqlite
:
'SMALLINT'
}
},
{
...
...
@@ -615,7 +624,7 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
SMALLINT
(
4
).
ZEROFILL
,
expect
:
{
default
:
'SMALLINT(4) ZEROFILL'
,
sqlite
:
'SMALLINT
ZEROFILL
(4)'
,
sqlite
:
'SMALLINT(4)'
,
postgres
:
'SMALLINT'
,
mssql
:
'SMALLINT'
}
...
...
@@ -626,7 +635,8 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
expect
:
{
default
:
'SMALLINT UNSIGNED ZEROFILL'
,
postgres
:
'SMALLINT'
,
mssql
:
'SMALLINT'
mssql
:
'SMALLINT'
,
sqlite
:
'SMALLINT'
}
},
{
...
...
@@ -634,7 +644,7 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
SMALLINT
(
4
).
ZEROFILL
.
UNSIGNED
,
expect
:
{
default
:
'SMALLINT(4) UNSIGNED ZEROFILL'
,
sqlite
:
'SMALLINT
UNSIGNED ZEROFILL
(4)'
,
sqlite
:
'SMALLINT(4)'
,
postgres
:
'SMALLINT'
,
mssql
:
'SMALLINT'
}
...
...
@@ -693,7 +703,8 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
title
:
'MEDIUMINT.UNSIGNED'
,
dataType
:
DataTypes
.
MEDIUMINT
.
UNSIGNED
,
expect
:
{
default
:
'MEDIUMINT UNSIGNED'
default
:
'MEDIUMINT UNSIGNED'
,
sqlite
:
'MEDIUMINT'
}
},
{
...
...
@@ -701,14 +712,15 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
MEDIUMINT
(
6
).
UNSIGNED
,
expect
:
{
default
:
'MEDIUMINT(6) UNSIGNED'
,
sqlite
:
'MEDIUMINT
UNSIGNED
(6)'
sqlite
:
'MEDIUMINT(6)'
}
},
{
title
:
'MEDIUMINT.UNSIGNED.ZEROFILL'
,
dataType
:
DataTypes
.
MEDIUMINT
.
UNSIGNED
.
ZEROFILL
,
expect
:
{
default
:
'MEDIUMINT UNSIGNED ZEROFILL'
default
:
'MEDIUMINT UNSIGNED ZEROFILL'
,
sqlite
:
'MEDIUMINT'
}
},
{
...
...
@@ -716,14 +728,15 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
MEDIUMINT
(
6
).
UNSIGNED
.
ZEROFILL
,
expect
:
{
default
:
'MEDIUMINT(6) UNSIGNED ZEROFILL'
,
sqlite
:
'MEDIUMINT
UNSIGNED ZEROFILL
(6)'
sqlite
:
'MEDIUMINT(6)'
}
},
{
title
:
'MEDIUMINT.ZEROFILL'
,
dataType
:
DataTypes
.
MEDIUMINT
.
ZEROFILL
,
expect
:
{
default
:
'MEDIUMINT ZEROFILL'
default
:
'MEDIUMINT ZEROFILL'
,
sqlite
:
'MEDIUMINT'
}
},
{
...
...
@@ -731,14 +744,15 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
MEDIUMINT
(
6
).
ZEROFILL
,
expect
:
{
default
:
'MEDIUMINT(6) ZEROFILL'
,
sqlite
:
'MEDIUMINT
ZEROFILL
(6)'
sqlite
:
'MEDIUMINT(6)'
}
},
{
title
:
'MEDIUMINT.ZEROFILL.UNSIGNED'
,
dataType
:
DataTypes
.
MEDIUMINT
.
ZEROFILL
.
UNSIGNED
,
expect
:
{
default
:
'MEDIUMINT UNSIGNED ZEROFILL'
default
:
'MEDIUMINT UNSIGNED ZEROFILL'
,
sqlite
:
'MEDIUMINT'
}
},
{
...
...
@@ -746,7 +760,7 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
dataType
:
DataTypes
.
MEDIUMINT
(
6
).
ZEROFILL
.
UNSIGNED
,
expect
:
{
default
:
'MEDIUMINT(6) UNSIGNED ZEROFILL'
,
sqlite
:
'MEDIUMINT
UNSIGNED ZEROFILL
(6)'
sqlite
:
'MEDIUMINT(6)'
}
}
];
...
...
@@ -784,13 +798,15 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
testsql
(
'BIGINT.UNSIGNED'
,
DataTypes
.
BIGINT
.
UNSIGNED
,
{
default
:
'BIGINT UNSIGNED'
,
postgres
:
'BIGINT'
,
mssql
:
'BIGINT'
mssql
:
'BIGINT'
,
sqlite
:
'BIGINT'
});
testsql
(
'BIGINT.UNSIGNED.ZEROFILL'
,
DataTypes
.
BIGINT
.
UNSIGNED
.
ZEROFILL
,
{
default
:
'BIGINT UNSIGNED ZEROFILL'
,
postgres
:
'BIGINT'
,
mssql
:
'BIGINT'
mssql
:
'BIGINT'
,
sqlite
:
'BIGINT'
});
testsql
(
'BIGINT(11)'
,
DataTypes
.
BIGINT
(
11
),
{
...
...
@@ -807,28 +823,28 @@ suite(Support.getTestDialectTeaser('SQL'), () => {
testsql
(
'BIGINT(11).UNSIGNED'
,
DataTypes
.
BIGINT
(
11
).
UNSIGNED
,
{
default
:
'BIGINT(11) UNSIGNED'
,
sqlite
:
'BIGINT
UNSIGNED
(11)'
,
sqlite
:
'BIGINT(11)'
,
postgres
:
'BIGINT'
,
mssql
:
'BIGINT'
});
testsql
(
'BIGINT(11).UNSIGNED.ZEROFILL'
,
DataTypes
.
BIGINT
(
11
).
UNSIGNED
.
ZEROFILL
,
{
default
:
'BIGINT(11) UNSIGNED ZEROFILL'
,
sqlite
:
'BIGINT
UNSIGNED ZEROFILL
(11)'
,
sqlite
:
'BIGINT(11)'
,
postgres
:
'BIGINT'
,
mssql
:
'BIGINT'
});
testsql
(
'BIGINT(11).ZEROFILL'
,
DataTypes
.
BIGINT
(
11
).
ZEROFILL
,
{
default
:
'BIGINT(11) ZEROFILL'
,
sqlite
:
'BIGINT
ZEROFILL
(11)'
,
sqlite
:
'BIGINT(11)'
,
postgres
:
'BIGINT'
,
mssql
:
'BIGINT'
});
testsql
(
'BIGINT(11).ZEROFILL.UNSIGNED'
,
DataTypes
.
BIGINT
(
11
).
ZEROFILL
.
UNSIGNED
,
{
default
:
'BIGINT(11) UNSIGNED ZEROFILL'
,
sqlite
:
'BIGINT
UNSIGNED ZEROFILL
(11)'
,
sqlite
:
'BIGINT(11)'
,
postgres
:
'BIGINT'
,
mssql
:
'BIGINT'
});
...
...
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