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 c8676789
authored
Jun 03, 2012
by
Sascha Depold
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #181 from grn/master
Fix #162
2 parents
d896c77a
76a14ab4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
lib/migration.js
lib/migration.js
View file @
c867678
...
@@ -10,8 +10,11 @@ module.exports = (function() {
...
@@ -10,8 +10,11 @@ module.exports = (function() {
this
.
migrator
=
migrator
this
.
migrator
=
migrator
this
.
path
=
path
this
.
path
=
path
this
.
filename
=
Utils
.
_
.
last
(
this
.
path
.
split
(
'/'
))
this
.
filename
=
Utils
.
_
.
last
(
this
.
path
.
split
(
'/'
))
this
.
migrationId
=
parseInt
(
this
.
filename
.
match
(
/
(
.*
)
-.*/
)[
1
])
this
.
date
=
Migration
.
stringToDate
(
this
.
filename
)
var
parsed
=
Migration
.
parseFilename
(
this
.
filename
)
this
.
migrationId
=
parsed
.
id
this
.
date
=
parsed
.
date
;
this
.
queryInterface
=
this
.
migrator
.
queryInterface
this
.
queryInterface
=
this
.
migrator
.
queryInterface
this
.
undoneMethods
=
0
this
.
undoneMethods
=
0
}
}
...
@@ -20,20 +23,17 @@ module.exports = (function() {
...
@@ -20,20 +23,17 @@ module.exports = (function() {
// static /////
// static /////
///////////////
///////////////
Migration
.
getFormattedDateString
=
function
(
s
)
{
Migration
.
parseFilename
=
function
(
s
)
{
var
result
=
null
var
matches
=
s
.
match
(
/^
((\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2}))[
-_
]
.+/
)
try
{
if
(
matches
===
null
)
{
result
=
s
.
match
(
/
(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})
/
).
slice
(
1
,
6
).
join
(
'-'
)
throw
new
Error
(
s
+
' is not a valid migration name! Use YYYYMMDDHHmmss-migration-name format.'
)
}
catch
(
e
)
{
throw
new
Error
(
s
+
' is no valid migration timestamp format! Use YYYYMMDDHHmmss!'
)
}
}
return
result
return
{
id
:
parseInt
(
matches
[
1
]),
date
:
moment
(
matches
.
slice
(
2
,
8
).
join
(
'-'
),
'YYYYMMDDHHmmss'
)
}
}
Migration
.
stringToDate
=
function
(
s
)
{
return
moment
(
Migration
.
getFormattedDateString
(
s
),
"YYYYMMDDHHmmss"
)
}
}
Migration
.
migrationHasInterfaceCalls
=
function
(
func
)
{
Migration
.
migrationHasInterfaceCalls
=
function
(
func
)
{
...
...
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