-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
156 lines (130 loc) · 4.34 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
declare module 'db-migrate' {
namespace DBMigrateNS {
class DBMigrate {
/**
* Add a global defined variable to db-migrate, to enable access from
* local migrations without configuring pathes.
*
* @return boolean
*/
addGlobal (library: string): boolean
/**
* Registers and initializes hooks.
*
* @returns Promise
*/
registerAPIHook (callback?: Function): Promise<any>
/**
* Add a configuration option to dbmigrate.
*
* @return boolean
*/
addConfiguration (description: string, args: any[], type: string): boolean
/**
* Resets and sets argv to a specified new argv.
*/
resetConfiguration (argv: any[]): void
/**
* Executes up a given number of migrations or a specific one.
*
* Defaults to up all migrations if no count is given.
*/
up (specification?: string | number | Function, opts?: string | Function, callback?: Function): Promise<any>
/**
* Executes up a given number of migrations or a specific one.
*
* Defaults to up all migrations if no count is given.
*/
down (specification?: number | Function, opts?: string | Function, callback?: Function): Promise<any>
check (specification?: number | Function, opts?: string | Function, callback?: Function): Promise<any>
/**
* Executes up a given number of migrations or a specific one.
*
* Defaults to up all migrations if no count is given.
*/
sync (specification?: string, opts?: string | Function, callback?: Function): Promise<any>
/**
* Executes down for all currently migrated migrations.
*/
reset (scope?: string | Function, callback?: Function): Promise<any>
/**
* Silence the log output completely.
*/
silence (isSilent: boolean): void
/**
* Transition migrations to the latest defined protocol.
*/
transition (): void
/**
* Creates a correctly formatted migration
*/
create (migrationName: string, scope?: string | Function, callback?: Function): Promise<any>
/**
* Creates a database of the given dbname.
*/
createDatabase (dbname: string, callback?: Function): Promise<any>
/**
* Drops a database of the given dbname.
*/
dropDatabase (dbname: string, callback?: Function): Promise<any>
/**
* Sets a config variable to the given value.
*
* @return value
*/
setConfigParam (param: string, value: any): any
/**
* Sets the callback to the default onComplete
*/
setDefaultCallback (): void
/**
* Let's the user customize the callback, which gets called after all
* migrations have been done.
*/
setCustomCallback (callback: Function): void
/**
* Seeds either the static or version controlled seeders, controlled by
* the passed mode.
*/
seed (mode?: string, scope?: string, callback?: Function): Promise<any>
/**
* Execute the down function of currently executed seeds.
*/
undoSeed (specification?: number | string, scope?: string, callback?: Function): Promise<any>
/**
* Execute the reset function of currently executed seeds.
*/
resetSeed (specification?: number | string, scope?: string, callback?: Function): Promise<any>
/**
* Executes the default routine.
*/
run (): void
}
function getInstance (isModule?: boolean, options?: InstanceOptions, callback?: Function): DBMigrate
interface InstanceOptions {
cwd?: string
config?: string | ConfigPerSource
cmdOptions?: Object
env?: string
throwUncatched?: boolean
noPlugins?: boolean
database?: string
multipleStatements?: boolean
}
interface ConfigPerSource {
[_: string]: ConfigPerSourceOptions | string
}
type UsingENV = { 'ENV': string }
interface ConfigPerSourceOptions {
driver: string | UsingENV
user?: string | UsingENV
password?: string | UsingENV
host?: string | UsingENV
port?: number | UsingENV
database?: string | UsingENV
filename?: string | UsingENV
schema?: string | UsingENV
}
}
export = DBMigrateNS
}