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 624e89f9
authored
Mar 28, 2014
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use new log method
1 parent
8d02f36b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
31 deletions
lib/dialects/mariadb/query.js
lib/dialects/mysql/query.js
lib/dialects/postgres/query.js
lib/dialects/sqlite/query.js
lib/migrator.js
lib/dialects/mariadb/query.js
View file @
624e89f
...
...
@@ -19,9 +19,7 @@ module.exports = (function() {
Query
.
prototype
.
run
=
function
(
sql
)
{
this
.
sql
=
sql
if
(
this
.
options
.
logging
!==
false
)
{
this
.
options
.
logging
(
'Executing ('
+
this
.
options
.
uuid
+
'): '
+
this
.
sql
)
}
this
.
sequelize
.
log
(
'Executing ('
+
this
.
options
.
uuid
+
'): '
+
this
.
sql
)
var
resultSet
=
[],
errorDetected
=
false
,
...
...
lib/dialects/mysql/query.js
View file @
624e89f
...
...
@@ -19,9 +19,7 @@ module.exports = (function() {
Query
.
prototype
.
run
=
function
(
sql
)
{
this
.
sql
=
sql
if
(
this
.
options
.
logging
!==
false
)
{
this
.
options
.
logging
(
'Executing ('
+
this
.
options
.
uuid
+
'): '
+
this
.
sql
)
}
this
.
sequelize
.
log
(
'Executing ('
+
this
.
options
.
uuid
+
'): '
+
this
.
sql
)
this
.
client
.
query
(
this
.
sql
,
function
(
err
,
results
,
fields
)
{
this
.
emit
(
'sql'
,
this
.
sql
)
...
...
lib/dialects/postgres/query.js
View file @
624e89f
...
...
@@ -27,9 +27,7 @@ module.exports = (function() {
,
query
=
this
.
client
.
query
(
sql
)
,
rows
=
[]
if
(
this
.
options
.
logging
!==
false
)
{
this
.
options
.
logging
(
'Executing ('
+
this
.
options
.
uuid
+
'): '
+
this
.
sql
)
}
this
.
sequelize
.
log
(
'Executing ('
+
this
.
options
.
uuid
+
'): '
+
this
.
sql
)
query
.
on
(
'row'
,
function
(
row
)
{
rows
.
push
(
row
)
...
...
lib/dialects/sqlite/query.js
View file @
624e89f
...
...
@@ -26,9 +26,7 @@ module.exports = (function() {
this
.
sql
=
sql
if
(
this
.
options
.
logging
!==
false
)
{
this
.
options
.
logging
(
'Executing ('
+
this
.
options
.
uuid
+
'): '
+
this
.
sql
)
}
this
.
sequelize
.
log
(
'Executing ('
+
this
.
options
.
uuid
+
'): '
+
this
.
sql
)
var
columnTypes
=
{}
this
.
database
.
serialize
(
function
()
{
...
...
lib/migrator.js
View file @
624e89f
...
...
@@ -15,16 +15,6 @@ module.exports = (function() {
logging
:
console
.
log
,
filesFilter
:
/
\.
js$/
},
options
||
{})
if
(
this
.
options
.
logging
===
true
)
{
console
.
log
(
'DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log'
)
this
.
options
.
logging
=
console
.
log
}
if
(
this
.
options
.
logging
==
console
.
log
)
{
// using just console.log will break in node < 0.6
this
.
options
.
logging
=
function
(
s
)
{
console
.
log
(
s
)
}
}
}
Object
.
defineProperty
(
Migrator
.
prototype
,
"queryInterface"
,
{
...
...
@@ -53,9 +43,9 @@ module.exports = (function() {
}
if
(
migrations
.
length
===
0
)
{
self
.
options
.
loggin
g
(
"There are no pending migrations."
)
self
.
sequelize
.
lo
g
(
"There are no pending migrations."
)
}
else
{
self
.
options
.
loggin
g
(
"Running migrations..."
)
self
.
sequelize
.
lo
g
(
"Running migrations..."
)
}
migrations
.
forEach
(
function
(
migration
)
{
...
...
@@ -63,9 +53,7 @@ module.exports = (function() {
chainer
.
add
(
migration
,
'execute'
,
[
options
],
{
before
:
function
(
migration
)
{
if
(
self
.
options
.
logging
!==
false
)
{
self
.
options
.
logging
(
migration
.
filename
)
}
self
.
sequelize
.
log
(
migration
.
filename
)
migrationTime
=
process
.
hrtime
()
},
...
...
@@ -73,9 +61,7 @@ module.exports = (function() {
migrationTime
=
process
.
hrtime
(
migrationTime
)
migrationTime
=
Math
.
round
(
(
migrationTime
[
0
]
*
1000
)
+
(
migrationTime
[
1
]
/
1000000
));
if
(
self
.
options
.
logging
!==
false
)
{
self
.
options
.
logging
(
'Completed in '
+
migrationTime
+
'ms'
)
}
self
.
sequelize
.
log
(
'Completed in '
+
migrationTime
+
'ms'
)
},
success
:
function
(
migration
,
callback
)
{
...
...
@@ -193,8 +179,10 @@ module.exports = (function() {
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
var
chainer
=
new
Utils
.
QueryChainer
()
var
addMigration
=
function
(
filename
)
{
self
.
options
.
logging
(
'Adding migration script at '
+
filename
)
var
migration
=
new
Migration
(
self
,
filename
)
self
.
sequelize
.
log
(
'Adding migration script at '
+
filename
)
chainer
.
add
(
migration
,
'execute'
,
[{
method
:
'up'
}],
{
before
:
function
(
migration
)
{
if
(
options
&&
Utils
.
_
.
isFunction
(
options
.
before
))
{
...
...
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