1
- import * as sqlformatter from 'sql-formatter' ;
2
-
3
1
import { SchemaDumpOptions } from './interfaces/Options' ;
4
2
import { Table } from './interfaces/Table' ;
5
3
import { DB } from './DB' ;
@@ -20,15 +18,7 @@ function isCreateView(v: ShowCreateTableStatementRes): v is ShowCreateView {
20
18
return 'View' in v ;
21
19
}
22
20
23
- async function getSchemaDump (
24
- connection : DB ,
25
- options : Required < SchemaDumpOptions > ,
26
- tables : Array < Table > ,
27
- ) : Promise < Array < Table > > {
28
- const format = options . format
29
- ? ( sql : string ) => sqlformatter . format ( sql )
30
- : ( sql : string ) => sql ;
31
-
21
+ async function getSchemaDump ( connection : DB , options : Required < SchemaDumpOptions > , tables : Array < Table > ) : Promise < Array < Table > > {
32
22
// we create a multi query here so we can query all at once rather than in individual connections
33
23
const getSchemaMultiQuery = tables
34
24
. map ( t => `SHOW CREATE TABLE \`${ t . name } \`;` )
@@ -44,7 +34,7 @@ async function getSchemaDump(
44
34
return {
45
35
...table ,
46
36
name : res . View ,
47
- schema : format ( res [ 'Create View' ] ) ,
37
+ schema : res [ 'Create View' ] ,
48
38
data : null ,
49
39
isView : true ,
50
40
} ;
@@ -53,7 +43,7 @@ async function getSchemaDump(
53
43
return {
54
44
...table ,
55
45
name : res . Table ,
56
- schema : format ( res [ 'Create Table' ] ) ,
46
+ schema : res [ 'Create Table' ] ,
57
47
data : null ,
58
48
isView : false ,
59
49
} ;
0 commit comments