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 a93bb7d1
authored
Feb 07, 2014
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that coffee files are correctly executed
1 parent
d01c7e11
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
lib/migration.js
package.json
test/migrator.test.js
lib/migration.js
View file @
a93bb7d
...
@@ -50,6 +50,15 @@ module.exports = (function() {
...
@@ -50,6 +50,15 @@ module.exports = (function() {
Object
.
defineProperty
(
Migration
.
prototype
,
'migration'
,
{
Object
.
defineProperty
(
Migration
.
prototype
,
'migration'
,
{
get
:
function
()
{
get
:
function
()
{
if
(
this
.
path
.
match
(
/
\.
coffee$/
))
{
try
{
require
(
'coffee-script/register'
)
}
catch
(
e
)
{
console
.
log
(
"You have to add \"coffee-script\" to your package.json."
)
process
.
exit
(
1
)
}
}
return
require
(
this
.
path
)
return
require
(
this
.
path
)
}
}
})
})
...
...
package.json
View file @
a93bb7d
...
@@ -69,7 +69,8 @@
...
@@ -69,7 +69,8 @@
"lcov-result-merger"
:
"0.0.2"
,
"lcov-result-merger"
:
"0.0.2"
,
"istanbul"
:
"~0.1.45"
,
"istanbul"
:
"~0.1.45"
,
"coveralls"
:
"~2.5.0"
,
"coveralls"
:
"~2.5.0"
,
"async"
:
"~0.2.9"
"async"
:
"~0.2.9"
,
"coffee-script"
:
"~1.7.1"
},
},
"keywords"
:
[
"keywords"
:
[
"mysql"
,
"mysql"
,
...
...
test/migrator.test.js
View file @
a93bb7d
...
@@ -30,7 +30,7 @@ describe(Support.getTestDialectTeaser("Migrator"), function() {
...
@@ -30,7 +30,7 @@ describe(Support.getTestDialectTeaser("Migrator"), function() {
describe
(
'getUndoneMigrations'
,
function
()
{
describe
(
'getUndoneMigrations'
,
function
()
{
it
(
"supports coffee files"
,
function
(
done
)
{
it
(
"supports coffee files"
,
function
(
done
)
{
this
.
init
({
this
.
init
({
filesFilter
:
/
\.
c
s
$/
,
filesFilter
:
/
\.
c
offee
$/
,
to
:
20111130161100
to
:
20111130161100
},
function
(
migrator
)
{
},
function
(
migrator
)
{
migrator
.
getUndoneMigrations
(
function
(
err
,
migrations
)
{
migrator
.
getUndoneMigrations
(
function
(
err
,
migrations
)
{
...
@@ -120,6 +120,24 @@ describe(Support.getTestDialectTeaser("Migrator"), function() {
...
@@ -120,6 +120,24 @@ describe(Support.getTestDialectTeaser("Migrator"), function() {
})
})
describe
(
'executions'
,
function
()
{
describe
(
'executions'
,
function
()
{
it
(
"supports coffee files"
,
function
(
done
)
{
var
self
=
this
this
.
init
({
filesFilter
:
/
\.
coffee$/
,
to
:
20111130161100
},
function
(
migrator
)
{
self
.
migrator
=
migrator
self
.
migrator
.
migrate
().
success
(
function
()
{
self
.
sequelize
.
getQueryInterface
().
showAllTables
().
success
(
function
(
tableNames
)
{
tableNames
=
tableNames
.
filter
(
function
(
e
){
return
e
!=
'SequelizeMeta'
})
expect
(
tableNames
).
to
.
eql
([
'Person'
])
done
()
})
})
})
})
it
(
"executes migration #20111117063700 and correctly creates the table"
,
function
(
done
)
{
it
(
"executes migration #20111117063700 and correctly creates the table"
,
function
(
done
)
{
this
.
sequelize
.
getQueryInterface
().
showAllTables
().
success
(
function
(
tableNames
)
{
this
.
sequelize
.
getQueryInterface
().
showAllTables
().
success
(
function
(
tableNames
)
{
tableNames
=
tableNames
.
filter
(
function
(
e
){
return
e
!=
'SequelizeMeta'
})
tableNames
=
tableNames
.
filter
(
function
(
e
){
return
e
!=
'SequelizeMeta'
})
...
...
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