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 a8497312
authored
Nov 17, 2011
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first steps for migrations
1 parent
1ebef999
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
lib/migrator.js
spec/assets/migrations/20111117063700-createPerson.js
spec/migrator.spec.js
lib/migrator.js
View file @
a849731
var
fs
=
require
(
"fs"
)
,
path
=
require
(
"path"
)
,
Utils
=
require
(
"./utils"
)
module
.
exports
=
(
function
()
{
var
Migrator
=
function
(
options
)
{
this
.
options
=
Utils
.
_
.
extend
({
path
:
__dirname
+
'/../migrations'
,
from
:
null
,
to
:
null
},
_
options
||
{})
},
options
||
{})
}
Migrator
.
prototype
.
migrate
=
function
()
{
getLastMigrationId
.
call
(
this
)
}
// private
var
getLastMigrationId
=
function
()
{
var
result
=
null
fs
.
readdirSync
(
this
.
options
.
path
).
filter
(
function
(
file
)
{
console
.
log
(
file
)
})
}
return
Migrator
...
...
spec/assets/migrations/20111117063700-createPerson.js
0 → 100644
View file @
a849731
module
.
exports
=
{
up
:
function
()
{
},
down
:
function
()
{
}
}
spec/migrator.spec.js
0 → 100644
View file @
a849731
var
config
=
require
(
"./config/config"
)
,
Sequelize
=
require
(
"../index"
)
,
sequelize
=
new
Sequelize
(
config
.
database
,
config
.
username
,
config
.
password
,
{
logging
:
false
})
,
Helpers
=
new
(
require
(
"./config/helpers"
))(
sequelize
)
,
Migrator
=
require
(
"../lib/migrator"
)
describe
(
'Migrator'
,
function
()
{
describe
(
'getLastMigrationId'
,
function
()
{
it
(
"should correctly transform array into IN"
,
function
()
{
new
Migrator
({
path
:
__dirname
+
'/assets/migrations'
}).
migrate
()
})
})
})
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