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 edd69197
authored
Mar 23, 2019
by
Simon Schick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: use native padStart
1 parent
345eb898
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
11 deletions
lib/dialects/postgres/query-generator.js
test/integration/model/create.test.js
lib/dialects/postgres/query-generator.js
View file @
edd6919
...
@@ -794,10 +794,6 @@ class PostgresQueryGenerator extends AbstractQueryGenerator {
...
@@ -794,10 +794,6 @@ class PostgresQueryGenerator extends AbstractQueryGenerator {
return
matches
.
slice
(
0
,
-
1
);
return
matches
.
slice
(
0
,
-
1
);
}
}
padInt
(
i
)
{
return
i
<
10
?
`0
${
i
.
toString
()}
`
:
i
.
toString
();
}
dataTypeMapping
(
tableName
,
attr
,
dataType
)
{
dataTypeMapping
(
tableName
,
attr
,
dataType
)
{
if
(
dataType
.
includes
(
'PRIMARY KEY'
))
{
if
(
dataType
.
includes
(
'PRIMARY KEY'
))
{
dataType
=
dataType
.
replace
(
'PRIMARY KEY'
,
''
);
dataType
=
dataType
.
replace
(
'PRIMARY KEY'
,
''
);
...
...
test/integration/model/create.test.js
View file @
edd6919
...
@@ -913,13 +913,8 @@ describe(Support.getTestDialectTeaser('Model'), () => {
...
@@ -913,13 +913,8 @@ describe(Support.getTestDialectTeaser('Model'), () => {
return
userWithDefaults
.
sync
({
force
:
true
}).
then
(()
=>
{
return
userWithDefaults
.
sync
({
force
:
true
}).
then
(()
=>
{
return
userWithDefaults
.
create
({}).
then
(
user
=>
{
return
userWithDefaults
.
create
({}).
then
(
user
=>
{
return
userWithDefaults
.
findByPk
(
user
.
id
).
then
(
user
=>
{
return
userWithDefaults
.
findByPk
(
user
.
id
).
then
(
user
=>
{
const
now
=
new
Date
(),
const
now
=
new
Date
();
pad
=
function
(
number
)
{
const
pad
=
number
=>
number
.
toString
().
padStart
(
2
,
'0'
);
if
(
number
>
9
)
{
return
number
;
}
return
`0
${
number
}
`
;
};
expect
(
user
.
year
).
to
.
equal
(
`
${
now
.
getUTCFullYear
()}
-
${
pad
(
now
.
getUTCMonth
()
+
1
)}
-
${
pad
(
now
.
getUTCDate
())}
`
);
expect
(
user
.
year
).
to
.
equal
(
`
${
now
.
getUTCFullYear
()}
-
${
pad
(
now
.
getUTCMonth
()
+
1
)}
-
${
pad
(
now
.
getUTCDate
())}
`
);
});
});
...
...
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