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
不要怂,就是干,撸起袖子干!
You need to sign in or sign up before continuing.
Commit 9e17fbbe
authored
Nov 28, 2011
by
sdepold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
showAllTables for QueryInterface
1 parent
5796cf7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
lib/query-interface.js
lib/query-interface.js
View file @
9e17fbb
...
...
@@ -10,6 +10,21 @@ module.exports = (function() {
return
query
.
call
(
this
,
this
.
QueryGenerator
.
createTableQuery
(
tableName
,
attributes
,
options
))
}
QueryInterface
.
prototype
.
showAllTables
=
function
()
{
var
self
=
this
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
self
.
sequelize
.
query
(
'SHOW TABLES;'
,
null
,
{
raw
:
true
}).
success
(
function
(
data
)
{
var
tableNames
=
Sequelize
.
Utils
.
_
.
map
(
data
,
function
(
hash
)
{
return
Sequelize
.
Utils
.
_
.
values
(
hash
)
})
emitter
.
emit
(
'success'
,
Sequelize
.
Utils
.
_
.
flatten
(
tableNames
))
}).
error
(
function
(
err
)
{
emitter
.
emit
(
'failure'
,
err
)
})
}).
run
()
}
QueryInterface
.
prototype
.
dropTable
=
function
(
tableName
)
{
return
query
.
call
(
this
,
this
.
QueryGenerator
.
dropTableQuery
(
tableName
))
}
...
...
@@ -20,11 +35,8 @@ module.exports = (function() {
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
var
chainer
=
new
Utils
.
QueryChainer
()
self
.
sequelize
.
query
(
'SHOW TABLES;'
,
null
,
{
raw
:
true
}).
success
(
function
(
data
)
{
var
tableNames
=
Sequelize
.
Utils
.
_
.
map
(
data
,
function
(
hash
)
{
return
Sequelize
.
Utils
.
_
.
values
(
hash
)
})
Sequelize
.
Utils
.
_
.
flatten
(
tableNames
).
forEach
(
function
(
tableName
)
{
self
.
showAllTables
().
success
(
function
(
tableNames
)
{
tableNames
.
forEach
(
function
(
tableName
)
{
chainer
.
add
(
self
.
sequelize
.
getQueryInterface
().
dropTable
(
tableName
))
})
chainer
...
...
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