Skip to content

Commit

Permalink
Add ORDER BY when selecting meta information to make output more
Browse files Browse the repository at this point in the history
stable
  • Loading branch information
huangjunwen committed May 16, 2019
1 parent 3ad6ab9 commit 3ceb27d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions datasrc/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ func (loader *Loader) LoadTableNames() ([]string, error) {
INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA=? AND TABLE_TYPE='BASE TABLE'
`, dbName)
ORDER BY
TABLE_NAME`, dbName)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -207,7 +208,9 @@ func (loader *Loader) LoadIndexNames(tableName string) ([]string, error) {
FROM
INFORMATION_SCHEMA.STATISTICS
WHERE
TABLE_SCHEMA=? AND TABLE_NAME=?`, dbName, tableName)
TABLE_SCHEMA=? AND TABLE_NAME=?
ORDER BY
INDEX_NAME`, dbName, tableName)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -289,7 +292,9 @@ func (loader *Loader) LoadFKNames(tableName string) ([]string, error) {
FROM
INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE
TABLE_SCHEMA=? AND TABLE_NAME = ? AND CONSTRAINT_TYPE = 'FOREIGN KEY'`, dbName, tableName)
TABLE_SCHEMA=? AND TABLE_NAME = ? AND CONSTRAINT_TYPE = 'FOREIGN KEY'
ORDER BY
CONSTRAINT_NAME`, dbName, tableName)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 3ceb27d

Please sign in to comment.