-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathmikro-orm.ts
220 lines (219 loc) · 6.52 KB
/
mikro-orm.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
const completionSpec: Fig.Spec = {
name: "mikro-orm",
description:
"TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases",
subcommands: [
{
name: "cache:clear",
description: "Clear metadata cache",
},
{
name: "cache:generate",
description: "Generate metadata cache for production",
},
{
name: "generate-entities",
description: "Generate entities based on current database schema",
options: [
{
name: ["-s", "--save"],
description: "Saves entities to directory defined by --path",
},
{
name: ["-d", "--dump"],
description: "Dumps all entities to console",
},
{
name: ["-p", "--path"],
description: "Sets path to directory where to save entities",
args: { name: "path", template: "folders" },
},
{
name: "--schema",
description: "Generates entities only for given schema",
args: { name: "schema" },
},
],
},
{
name: "database:create",
description: "Create your database if it does not exist",
},
{
name: "database:import",
description: "Imports the SQL file to the database",
args: { name: "file", template: "filepaths" },
},
{
name: "seeder:run",
description: "Seed the database using the seeder class",
},
{
name: "seeder:create",
description: "Create a new seeder class",
options: [{ name: "--class", description: "Seeder class to run" }],
},
{
name: "schema:create",
description: "Create database schema based on current metadata",
options: [
{ name: ["-r", "--run"], description: "Runs queries" },
{ name: ["-d", "--dump"], description: "Dumps all queries to console" },
{ name: "--fk-checks", description: "Do not skip foreign key checks" },
{
name: "--schema",
description: "Set the current schema for wildcard schema entities",
args: { name: "schema" },
},
{
name: "--seed",
description:
"Allows to seed the database on create or drop and recreate",
args: { name: "seed" },
},
],
},
{
name: "schema:drop",
description: "Drop database schema based on current metadata",
options: [
{ name: ["-r", "--run"], description: "Runs queries" },
{ name: ["-d", "--dump"], description: "Dumps all queries to console" },
{ name: "--fk-checks", description: "Do not skip foreign key checks" },
{
name: "--schema",
description: "Set the current schema for wildcard schema entities",
args: { name: "schema" },
},
{
name: "--drop-migrations-table",
description: "Drop also migrations table",
},
{ name: "--drop-db", description: "Drop the whole database" },
],
},
{
name: "schema:update",
description: "Update database schema based on current metadata",
options: [
{ name: ["-r", "--run"], description: "Runs queries" },
{ name: ["-d", "--dump"], description: "Dumps all queries to console" },
{ name: "--fk-checks", description: "Do not skip foreign key checks" },
{
name: "--schema",
description: "Set the current schema for wildcard schema entities",
args: { name: "schema" },
},
{
name: "--safe",
description: "Allows to disable table and column dropping",
},
{
name: "--drop-tables",
description: "Allows to disable table dropping",
},
],
},
{
name: "schema:fresh",
description:
"Drop and recreate database schema based on current metadata",
options: [
{ name: ["-r", "--run"], description: "Runs queries" },
{
name: "--schema",
description: "Set the current schema for wildcard schema entities",
args: { name: "schema" },
},
{
name: "--seed",
description:
"Allows to seed the database on create or drop and recreate",
args: { name: "seed" },
},
],
},
{
name: "migration:create",
description: "Create new migration with current schema diff",
options: [
{ name: ["-b", "--blank"], description: "Create blank migration" },
{ name: ["-i", "--initial"], description: "Create initial migration" },
{ name: ["-d", "--dump"], description: "Dumps all queries to console" },
{
name: ["-p", "--path"],
description: "Sets path to directory where to save entities",
args: { name: "path", template: "folders" },
},
],
},
{
name: "migration:up",
description: "Migrate up to the latest version",
options: [
{ name: ["-t", "--to"], description: "Migrate up to specific version" },
{
name: ["-f", "--from"],
description: "Start migration from specific version",
},
{
name: ["-o", "--only"],
description: "Migrate only specified versions",
},
],
},
{
name: "migration:down",
description: "Migrate one step down",
options: [
{
name: ["-t", "--to"],
description: "Migrate down to specific version",
},
{
name: ["-f", "--from"],
description: "Start migration from specific version",
},
{
name: ["-o", "--only"],
description: "Migrate only specified versions",
},
],
},
{
name: "migration:list",
description: "List all executed migrations",
},
{
name: "migration:pending",
description: "List all pending migrations",
},
{
name: "migration:fresh",
description: "Clear the database and rerun all migrations",
options: [
{
name: "--seed",
description:
"Allows to seed the database on create or drop and recreate",
args: { name: "seed" },
},
],
},
{
name: "debug",
description: "Debug CLI configuration",
},
],
options: [
{
name: ["-v", "--version"],
description: "Show version number",
},
{
name: ["-h", "--help"],
description: "Show help",
},
],
};
export default completionSpec;