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 c17a6c71
authored
Nov 30, 2011
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
method for checking the availability of interface calls in a migration method
1 parent
b8cca92c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
lib/migration.js
lib/migration.js
View file @
c17a6c7
...
@@ -47,15 +47,35 @@ module.exports = (function() {
...
@@ -47,15 +47,35 @@ module.exports = (function() {
method
:
'up'
method
:
'up'
},
options
||
{})
},
options
||
{})
extendMigrationWithQueryInterfaceMethods
.
call
(
self
,
function
allMethodsDone
()
{
var
onSuccess
=
function
()
{
emitter
.
emit
(
'success'
,
null
)
}
emitter
.
emit
(
'success'
,
null
)
,
func
=
self
.
migration
[
options
.
method
]
})
var
methods
=
require
(
self
.
path
)
extendMigrationWithQueryInterfaceMethods
.
call
(
self
,
onSuccess
)
methods
[
options
.
method
].
call
(
null
,
self
,
DataTypes
)
func
.
call
(
null
,
self
,
DataTypes
)
if
(
!
self
.
migrationHasInterfaceCalls
(
func
))
onSuccess
()
}).
run
()
}).
run
()
}
}
Object
.
defineProperty
(
Migration
.
prototype
,
'migration'
,
{
get
:
function
()
{
return
require
(
this
.
path
)
}
})
Migration
.
prototype
.
migrationHasInterfaceCalls
=
function
(
func
)
{
var
functionString
=
Utils
.
removeCommentsFromFunctionString
(
func
.
toString
())
,
hasCalls
=
false
for
(
var
method
in
QueryInterface
.
prototype
)
{
var
regex
=
new
RegExp
(
'\\.'
+
method
)
hasCalls
=
hasCalls
||
regex
.
test
(
functionString
)
}
return
hasCalls
}
Migration
.
prototype
.
isBefore
=
function
(
dateString
,
options
)
{
Migration
.
prototype
.
isBefore
=
function
(
dateString
,
options
)
{
options
=
Utils
.
_
.
extend
({
options
=
Utils
.
_
.
extend
({
withoutEquals
:
false
withoutEquals
:
false
...
@@ -106,5 +126,6 @@ module.exports = (function() {
...
@@ -106,5 +126,6 @@ module.exports = (function() {
}
}
}
}
return
Migration
return
Migration
})()
})()
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