@db-bridge/core 1.1.5 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/dist/cli/index.js +419 -18
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +162 -114
- package/dist/index.js +327 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -48,6 +48,227 @@ var ISOLATION_LEVELS = {
|
|
|
48
48
|
SERIALIZABLE: "SERIALIZABLE"
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
// src/types/TypeGenerator.ts
|
|
52
|
+
var SQL_TYPE_MAP = {
|
|
53
|
+
// Integers
|
|
54
|
+
tinyint: "number",
|
|
55
|
+
smallint: "number",
|
|
56
|
+
mediumint: "number",
|
|
57
|
+
int: "number",
|
|
58
|
+
integer: "number",
|
|
59
|
+
bigint: "number",
|
|
60
|
+
// Floats
|
|
61
|
+
float: "number",
|
|
62
|
+
double: "number",
|
|
63
|
+
decimal: "number",
|
|
64
|
+
numeric: "number",
|
|
65
|
+
real: "number",
|
|
66
|
+
// Strings
|
|
67
|
+
char: "string",
|
|
68
|
+
varchar: "string",
|
|
69
|
+
tinytext: "string",
|
|
70
|
+
text: "string",
|
|
71
|
+
mediumtext: "string",
|
|
72
|
+
longtext: "string",
|
|
73
|
+
enum: "string",
|
|
74
|
+
set: "string",
|
|
75
|
+
// Binary
|
|
76
|
+
binary: "Buffer",
|
|
77
|
+
varbinary: "Buffer",
|
|
78
|
+
tinyblob: "Buffer",
|
|
79
|
+
blob: "Buffer",
|
|
80
|
+
mediumblob: "Buffer",
|
|
81
|
+
longblob: "Buffer",
|
|
82
|
+
// Date/Time
|
|
83
|
+
date: "Date",
|
|
84
|
+
datetime: "Date",
|
|
85
|
+
timestamp: "Date",
|
|
86
|
+
time: "string",
|
|
87
|
+
year: "number",
|
|
88
|
+
// Boolean
|
|
89
|
+
boolean: "boolean",
|
|
90
|
+
bool: "boolean",
|
|
91
|
+
// JSON
|
|
92
|
+
json: "Record<string, unknown>",
|
|
93
|
+
jsonb: "Record<string, unknown>",
|
|
94
|
+
// UUID (PostgreSQL)
|
|
95
|
+
uuid: "string",
|
|
96
|
+
// Arrays (PostgreSQL)
|
|
97
|
+
array: "unknown[]"
|
|
98
|
+
};
|
|
99
|
+
var TypeGenerator = class {
|
|
100
|
+
constructor(adapter, dialect) {
|
|
101
|
+
this.adapter = adapter;
|
|
102
|
+
this.dialect = dialect;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Generate TypeScript interfaces from database schema
|
|
106
|
+
*/
|
|
107
|
+
async generate(options = {}) {
|
|
108
|
+
const tables = await this.getTables(options);
|
|
109
|
+
const output = [];
|
|
110
|
+
if (options.header) {
|
|
111
|
+
output.push(options.header);
|
|
112
|
+
output.push("");
|
|
113
|
+
} else {
|
|
114
|
+
output.push("/**");
|
|
115
|
+
output.push(" * Auto-generated TypeScript types from database schema");
|
|
116
|
+
output.push(` * Generated at: ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
117
|
+
output.push(" * DO NOT EDIT - This file is auto-generated");
|
|
118
|
+
output.push(" */");
|
|
119
|
+
output.push("");
|
|
120
|
+
}
|
|
121
|
+
for (const table of tables) {
|
|
122
|
+
const tableInfo = await this.getTableInfo(table);
|
|
123
|
+
const interfaceCode = this.generateInterface(tableInfo, options);
|
|
124
|
+
output.push(interfaceCode);
|
|
125
|
+
output.push("");
|
|
126
|
+
}
|
|
127
|
+
return output.join("\n");
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get list of tables from database
|
|
131
|
+
*/
|
|
132
|
+
async getTables(options) {
|
|
133
|
+
let tables;
|
|
134
|
+
if (this.dialect === "mysql") {
|
|
135
|
+
const result = await this.adapter.query(
|
|
136
|
+
`SELECT table_name FROM information_schema.tables
|
|
137
|
+
WHERE table_schema = DATABASE() AND table_type = 'BASE TABLE'`
|
|
138
|
+
);
|
|
139
|
+
tables = result.rows.map((r) => r["table_name"] || r["TABLE_NAME"]).filter((t) => t !== null && t !== void 0);
|
|
140
|
+
} else {
|
|
141
|
+
const result = await this.adapter.query(
|
|
142
|
+
`SELECT table_name FROM information_schema.tables
|
|
143
|
+
WHERE table_schema = 'public' AND table_type = 'BASE TABLE'`
|
|
144
|
+
);
|
|
145
|
+
tables = result.rows.map((r) => r["table_name"] || r["TABLE_NAME"]).filter((t) => t !== null && t !== void 0);
|
|
146
|
+
}
|
|
147
|
+
if (options.tables && options.tables.length > 0) {
|
|
148
|
+
tables = tables.filter((t) => options.tables.includes(t));
|
|
149
|
+
}
|
|
150
|
+
if (options.exclude && options.exclude.length > 0) {
|
|
151
|
+
tables = tables.filter((t) => !options.exclude.includes(t));
|
|
152
|
+
}
|
|
153
|
+
tables = tables.filter((t) => !t.startsWith("db_migrations") && !t.startsWith("db_bridge"));
|
|
154
|
+
return tables.sort();
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get column information for a table
|
|
158
|
+
*/
|
|
159
|
+
async getTableInfo(tableName) {
|
|
160
|
+
let columns;
|
|
161
|
+
if (this.dialect === "mysql") {
|
|
162
|
+
columns = await this.getMySQLColumns(tableName);
|
|
163
|
+
} else {
|
|
164
|
+
columns = await this.getPostgreSQLColumns(tableName);
|
|
165
|
+
}
|
|
166
|
+
return { name: tableName, columns };
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get MySQL column information
|
|
170
|
+
*/
|
|
171
|
+
async getMySQLColumns(tableName) {
|
|
172
|
+
const result = await this.adapter.query(`SHOW FULL COLUMNS FROM \`${tableName}\``);
|
|
173
|
+
return result.rows.map((row) => ({
|
|
174
|
+
name: row.Field,
|
|
175
|
+
type: this.parseColumnType(row.Type),
|
|
176
|
+
nullable: row.Null === "YES",
|
|
177
|
+
defaultValue: row.Default,
|
|
178
|
+
isPrimary: row.Key === "PRI",
|
|
179
|
+
isAutoIncrement: row.Extra.includes("auto_increment"),
|
|
180
|
+
comment: row.Comment || void 0
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Get PostgreSQL column information
|
|
185
|
+
*/
|
|
186
|
+
async getPostgreSQLColumns(tableName) {
|
|
187
|
+
const result = await this.adapter.query(
|
|
188
|
+
`
|
|
189
|
+
SELECT
|
|
190
|
+
c.column_name,
|
|
191
|
+
c.data_type,
|
|
192
|
+
c.is_nullable,
|
|
193
|
+
c.column_default,
|
|
194
|
+
c.is_identity,
|
|
195
|
+
pgd.description
|
|
196
|
+
FROM information_schema.columns c
|
|
197
|
+
LEFT JOIN pg_catalog.pg_statio_all_tables st ON c.table_name = st.relname
|
|
198
|
+
LEFT JOIN pg_catalog.pg_description pgd ON pgd.objoid = st.relid
|
|
199
|
+
AND pgd.objsubid = c.ordinal_position
|
|
200
|
+
WHERE c.table_name = $1
|
|
201
|
+
ORDER BY c.ordinal_position
|
|
202
|
+
`,
|
|
203
|
+
[tableName]
|
|
204
|
+
);
|
|
205
|
+
return result.rows.map((row) => ({
|
|
206
|
+
name: row.column_name,
|
|
207
|
+
type: row.data_type,
|
|
208
|
+
nullable: row.is_nullable === "YES",
|
|
209
|
+
defaultValue: row.column_default,
|
|
210
|
+
isPrimary: false,
|
|
211
|
+
// Would need additional query
|
|
212
|
+
isAutoIncrement: row.is_identity === "YES" || (row.column_default?.includes("nextval") ?? false),
|
|
213
|
+
comment: row.description
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Parse column type (extract base type from full type string)
|
|
218
|
+
*/
|
|
219
|
+
parseColumnType(fullType) {
|
|
220
|
+
const baseType = fullType.toLowerCase().replace(/\(.*\)/, "").trim();
|
|
221
|
+
return baseType.replace(" unsigned", "");
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Map SQL type to TypeScript type
|
|
225
|
+
*/
|
|
226
|
+
mapType(sqlType, nullable) {
|
|
227
|
+
const baseType = this.parseColumnType(sqlType);
|
|
228
|
+
if (sqlType.toLowerCase().includes("tinyint(1)")) {
|
|
229
|
+
return nullable ? "boolean | null" : "boolean";
|
|
230
|
+
}
|
|
231
|
+
const tsType = SQL_TYPE_MAP[baseType] || "unknown";
|
|
232
|
+
return nullable ? `${tsType} | null` : tsType;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Generate TypeScript interface for a table
|
|
236
|
+
*/
|
|
237
|
+
generateInterface(table, options) {
|
|
238
|
+
const lines = [];
|
|
239
|
+
const interfaceName = this.toInterfaceName(table.name);
|
|
240
|
+
if (options.includeComments) {
|
|
241
|
+
lines.push("/**");
|
|
242
|
+
lines.push(` * ${interfaceName} - ${table.name} table`);
|
|
243
|
+
lines.push(" */");
|
|
244
|
+
}
|
|
245
|
+
lines.push(`export interface ${interfaceName} {`);
|
|
246
|
+
for (const column of table.columns) {
|
|
247
|
+
const propertyName = options.camelCase ? this.toCamelCase(column.name) : column.name;
|
|
248
|
+
const tsType = this.mapType(column.type, column.nullable);
|
|
249
|
+
const optional = options.optionalNullable && column.nullable ? "?" : "";
|
|
250
|
+
if (options.includeComments && column.comment) {
|
|
251
|
+
lines.push(` /** ${column.comment} */`);
|
|
252
|
+
}
|
|
253
|
+
lines.push(` ${propertyName}${optional}: ${tsType};`);
|
|
254
|
+
}
|
|
255
|
+
lines.push("}");
|
|
256
|
+
return lines.join("\n");
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Convert table name to PascalCase interface name
|
|
260
|
+
*/
|
|
261
|
+
toInterfaceName(tableName) {
|
|
262
|
+
return tableName.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join("");
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Convert snake_case to camelCase
|
|
266
|
+
*/
|
|
267
|
+
toCamelCase(name) {
|
|
268
|
+
return name.replaceAll(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
|
|
51
272
|
// src/types/index.ts
|
|
52
273
|
var IsolationLevel = /* @__PURE__ */ ((IsolationLevel2) => {
|
|
53
274
|
IsolationLevel2["READ_UNCOMMITTED"] = "READ UNCOMMITTED";
|
|
@@ -2109,7 +2330,7 @@ var MigrationRunner = class {
|
|
|
2109
2330
|
};
|
|
2110
2331
|
}
|
|
2111
2332
|
};
|
|
2112
|
-
var MIGRATION_PATTERN = /^(\d{14})_(.+)\.(ts|js|mjs)$/;
|
|
2333
|
+
var MIGRATION_PATTERN = /^(?:([_a-z]+)_)?(\d{14})_(.+)\.(ts|js|mjs)$/;
|
|
2113
2334
|
var MigrationLoader = class {
|
|
2114
2335
|
directory;
|
|
2115
2336
|
extensions;
|
|
@@ -2136,12 +2357,13 @@ var MigrationLoader = class {
|
|
|
2136
2357
|
if (!match) {
|
|
2137
2358
|
continue;
|
|
2138
2359
|
}
|
|
2139
|
-
const [, timestamp, description] = match;
|
|
2360
|
+
const [, prefix, timestamp, description] = match;
|
|
2140
2361
|
files.push({
|
|
2141
2362
|
name: basename(entry.name, ext),
|
|
2142
2363
|
path: join(this.directory, entry.name),
|
|
2143
2364
|
timestamp,
|
|
2144
|
-
description: description.replaceAll("_", " ")
|
|
2365
|
+
description: description.replaceAll("_", " "),
|
|
2366
|
+
prefix
|
|
2145
2367
|
});
|
|
2146
2368
|
}
|
|
2147
2369
|
files.sort((a, b) => a.timestamp.localeCompare(b.timestamp));
|
|
@@ -2218,8 +2440,10 @@ var MigrationLoader = class {
|
|
|
2218
2440
|
}
|
|
2219
2441
|
/**
|
|
2220
2442
|
* Generate a new migration filename
|
|
2443
|
+
* @param description - Migration description
|
|
2444
|
+
* @param prefix - Optional prefix (e.g., 'auth' -> auth_20250119_xxx.ts)
|
|
2221
2445
|
*/
|
|
2222
|
-
static generateFilename(description) {
|
|
2446
|
+
static generateFilename(description, prefix) {
|
|
2223
2447
|
const now = /* @__PURE__ */ new Date();
|
|
2224
2448
|
const timestamp = [
|
|
2225
2449
|
now.getFullYear(),
|
|
@@ -2230,7 +2454,8 @@ var MigrationLoader = class {
|
|
|
2230
2454
|
String(now.getSeconds()).padStart(2, "0")
|
|
2231
2455
|
].join("");
|
|
2232
2456
|
const sanitizedDescription = description.toLowerCase().replaceAll(/[^\da-z]+/g, "_").replaceAll(/^_+|_+$/g, "");
|
|
2233
|
-
|
|
2457
|
+
const sanitizedPrefix = prefix ? prefix.toLowerCase().replaceAll(/[^\da-z]+/g, "_").replaceAll(/^_+|_+$/g, "") : null;
|
|
2458
|
+
return sanitizedPrefix ? `${sanitizedPrefix}_${timestamp}_${sanitizedDescription}.ts` : `${timestamp}_${sanitizedDescription}.ts`;
|
|
2234
2459
|
}
|
|
2235
2460
|
/**
|
|
2236
2461
|
* Get migration template content
|
|
@@ -3710,8 +3935,11 @@ var ForeignKeyChain = class {
|
|
|
3710
3935
|
var SchemaBuilder = class {
|
|
3711
3936
|
dialectInstance;
|
|
3712
3937
|
adapter;
|
|
3938
|
+
collectMode;
|
|
3939
|
+
collectedStatements = [];
|
|
3713
3940
|
constructor(options) {
|
|
3714
3941
|
this.adapter = options.adapter;
|
|
3942
|
+
this.collectMode = options.collectMode ?? false;
|
|
3715
3943
|
switch (options.dialect) {
|
|
3716
3944
|
case "mysql": {
|
|
3717
3945
|
this.dialectInstance = new MySQLDialect();
|
|
@@ -3817,6 +4045,14 @@ var SchemaBuilder = class {
|
|
|
3817
4045
|
* Execute SQL statement
|
|
3818
4046
|
*/
|
|
3819
4047
|
async execute(sql2, params) {
|
|
4048
|
+
if (this.collectMode) {
|
|
4049
|
+
let statement = sql2;
|
|
4050
|
+
if (params && params.length > 0) {
|
|
4051
|
+
statement += ` -- params: ${JSON.stringify(params)}`;
|
|
4052
|
+
}
|
|
4053
|
+
this.collectedStatements.push(statement);
|
|
4054
|
+
return;
|
|
4055
|
+
}
|
|
3820
4056
|
if (this.adapter) {
|
|
3821
4057
|
await this.adapter.execute(sql2, params);
|
|
3822
4058
|
} else {
|
|
@@ -3826,6 +4062,18 @@ var SchemaBuilder = class {
|
|
|
3826
4062
|
}
|
|
3827
4063
|
}
|
|
3828
4064
|
}
|
|
4065
|
+
/**
|
|
4066
|
+
* Get collected SQL statements (only in collectMode)
|
|
4067
|
+
*/
|
|
4068
|
+
getCollectedStatements() {
|
|
4069
|
+
return [...this.collectedStatements];
|
|
4070
|
+
}
|
|
4071
|
+
/**
|
|
4072
|
+
* Clear collected SQL statements
|
|
4073
|
+
*/
|
|
4074
|
+
clearCollectedStatements() {
|
|
4075
|
+
this.collectedStatements = [];
|
|
4076
|
+
}
|
|
3829
4077
|
/**
|
|
3830
4078
|
* Execute SQL query
|
|
3831
4079
|
*/
|
|
@@ -4281,7 +4529,23 @@ var FileMigrationRunner = class {
|
|
|
4281
4529
|
const action = direction === "up" ? "Running" : "Rolling back";
|
|
4282
4530
|
this.options.logger.info(`${action}: ${migration.name}`);
|
|
4283
4531
|
if (this.options.dryRun) {
|
|
4284
|
-
|
|
4532
|
+
const schema = new SchemaBuilder({
|
|
4533
|
+
dialect: this.options.dialect,
|
|
4534
|
+
collectMode: true
|
|
4535
|
+
});
|
|
4536
|
+
await migration[direction](schema);
|
|
4537
|
+
const statements = schema.getCollectedStatements();
|
|
4538
|
+
if (statements.length > 0) {
|
|
4539
|
+
this.options.logger.info(`DRY RUN: ${direction.toUpperCase()} ${migration.name}`);
|
|
4540
|
+
this.options.logger.info("SQL statements that would be executed:");
|
|
4541
|
+
for (const sql2 of statements) {
|
|
4542
|
+
this.options.logger.info(` ${sql2}`);
|
|
4543
|
+
}
|
|
4544
|
+
} else {
|
|
4545
|
+
this.options.logger.info(
|
|
4546
|
+
`DRY RUN: ${direction.toUpperCase()} ${migration.name} (no SQL statements)`
|
|
4547
|
+
);
|
|
4548
|
+
}
|
|
4285
4549
|
return;
|
|
4286
4550
|
}
|
|
4287
4551
|
const transaction = migration.transactional ? await this.adapter.beginTransaction() : null;
|
|
@@ -4477,20 +4741,61 @@ var ExpandContractHelper = class {
|
|
|
4477
4741
|
function createExpandContractHelper(adapter, schema) {
|
|
4478
4742
|
return new ExpandContractHelper(adapter, schema);
|
|
4479
4743
|
}
|
|
4744
|
+
var DEFAULT_PRIORITY = 100;
|
|
4480
4745
|
var SeederLoader = class {
|
|
4481
4746
|
constructor(directory) {
|
|
4482
4747
|
this.directory = directory;
|
|
4483
4748
|
}
|
|
4484
4749
|
/**
|
|
4485
|
-
* Load all seeder files from directory
|
|
4750
|
+
* Load all seeder files from directory (sorted by priority/dependencies)
|
|
4486
4751
|
*/
|
|
4487
4752
|
async loadAll() {
|
|
4488
4753
|
const files = await readdir(this.directory);
|
|
4489
|
-
const
|
|
4754
|
+
const seederPaths = files.filter((f) => /\.(ts|js|mjs)$/.test(f) && !f.endsWith(".d.ts")).map((f) => ({
|
|
4490
4755
|
name: this.getSeederName(f),
|
|
4491
4756
|
path: resolve(this.directory, f)
|
|
4492
4757
|
}));
|
|
4493
|
-
|
|
4758
|
+
const seederFiles = [];
|
|
4759
|
+
for (const file of seederPaths) {
|
|
4760
|
+
const seeder = await this.load(file.path);
|
|
4761
|
+
seederFiles.push({
|
|
4762
|
+
name: file.name,
|
|
4763
|
+
path: file.path,
|
|
4764
|
+
priority: seeder.priority ?? DEFAULT_PRIORITY,
|
|
4765
|
+
depends: seeder.depends
|
|
4766
|
+
});
|
|
4767
|
+
}
|
|
4768
|
+
return this.sortByDependencies(seederFiles);
|
|
4769
|
+
}
|
|
4770
|
+
/**
|
|
4771
|
+
* Sort seeders by dependencies (topological sort) then by priority
|
|
4772
|
+
*/
|
|
4773
|
+
sortByDependencies(files) {
|
|
4774
|
+
const fileMap = new Map(files.map((f) => [f.name, f]));
|
|
4775
|
+
const visited = /* @__PURE__ */ new Set();
|
|
4776
|
+
const result = [];
|
|
4777
|
+
const visit = (file) => {
|
|
4778
|
+
if (visited.has(file.name)) {
|
|
4779
|
+
return;
|
|
4780
|
+
}
|
|
4781
|
+
visited.add(file.name);
|
|
4782
|
+
if (file.depends) {
|
|
4783
|
+
for (const dep of file.depends) {
|
|
4784
|
+
const depFile = fileMap.get(dep) || fileMap.get(`${dep}_seeder`);
|
|
4785
|
+
if (depFile) {
|
|
4786
|
+
visit(depFile);
|
|
4787
|
+
}
|
|
4788
|
+
}
|
|
4789
|
+
}
|
|
4790
|
+
result.push(file);
|
|
4791
|
+
};
|
|
4792
|
+
const sortedByPriority = [...files].sort(
|
|
4793
|
+
(a, b) => (a.priority ?? DEFAULT_PRIORITY) - (b.priority ?? DEFAULT_PRIORITY)
|
|
4794
|
+
);
|
|
4795
|
+
for (const file of sortedByPriority) {
|
|
4796
|
+
visit(file);
|
|
4797
|
+
}
|
|
4798
|
+
return result;
|
|
4494
4799
|
}
|
|
4495
4800
|
/**
|
|
4496
4801
|
* Load a specific seeder by path
|
|
@@ -4512,10 +4817,13 @@ var SeederLoader = class {
|
|
|
4512
4817
|
}
|
|
4513
4818
|
/**
|
|
4514
4819
|
* Generate a new seeder filename
|
|
4820
|
+
* @param name - Seeder name
|
|
4821
|
+
* @param prefix - Optional prefix (e.g., 'auth' -> auth_users_seeder.ts)
|
|
4515
4822
|
*/
|
|
4516
|
-
static generateFilename(name) {
|
|
4823
|
+
static generateFilename(name, prefix) {
|
|
4517
4824
|
const snakeName = name.replaceAll(/([a-z])([A-Z])/g, "$1_$2").replaceAll(/[\s-]+/g, "_").toLowerCase();
|
|
4518
|
-
|
|
4825
|
+
const sanitizedPrefix = prefix ? prefix.toLowerCase().replaceAll(/[^\da-z]+/g, "_").replaceAll(/^_+|_+$/g, "") : null;
|
|
4826
|
+
return sanitizedPrefix ? `${sanitizedPrefix}_${snakeName}_seeder.ts` : `${snakeName}_seeder.ts`;
|
|
4519
4827
|
}
|
|
4520
4828
|
/**
|
|
4521
4829
|
* Get seeder template
|
|
@@ -4529,10 +4837,16 @@ var SeederLoader = class {
|
|
|
4529
4837
|
import type { Seeder, DatabaseAdapter } from '@db-bridge/core';
|
|
4530
4838
|
|
|
4531
4839
|
export default {
|
|
4840
|
+
// Priority: lower runs first (default: 100)
|
|
4841
|
+
// priority: 10,
|
|
4842
|
+
|
|
4843
|
+
// Dependencies: seeders that must run before this one
|
|
4844
|
+
// depends: ['users'],
|
|
4845
|
+
|
|
4532
4846
|
async run(adapter: DatabaseAdapter): Promise<void> {
|
|
4533
4847
|
// Insert seed data
|
|
4534
4848
|
// await adapter.execute(\`
|
|
4535
|
-
// INSERT INTO
|
|
4849
|
+
// INSERT INTO ${name} (name, email) VALUES
|
|
4536
4850
|
// ('John Doe', 'john@example.com'),
|
|
4537
4851
|
// ('Jane Doe', 'jane@example.com')
|
|
4538
4852
|
// \`);
|
|
@@ -10324,6 +10638,6 @@ var DBBridge3 = class _DBBridge {
|
|
|
10324
10638
|
}
|
|
10325
10639
|
};
|
|
10326
10640
|
|
|
10327
|
-
export { ANALYSIS_DEFAULTS, AlterTableBuilder, BaseAdapter, BaseQueryBuilder, BaseTransaction, CACHE_DEFAULTS, CONNECTION_DEFAULTS, CRYPTO_DEFAULTS, CacheAPI, CacheError, CacheKeyGenerator, CacheManager, CacheableQuery, CachedAdapter, CachedDBBridge, DBBridge as Client, ColumnBuilder, ConnectionError, CryptoAlgorithms, CryptoProvider, DBBridge2 as DBBridge, DBBridgeError, DBBridge3 as DBBridgeFactory, DEFAULT_POOL_CONFIG, DEFAULT_TIMEOUTS, DURATION_BUCKETS, DatabaseError, DefaultCacheStrategy, DeleteBuilder, DialectFactory, ExpandContractHelper, FileMigrationRunner, ForeignKeyBuilder, ForeignKeyChain, HEALTH_DEFAULTS, HealthChecker, ISOLATION_LEVELS, InsertBuilder, IsolationLevel, LOGGING_DEFAULTS, MetricsCollector, MiddlewareChain, MigrationLoader, MigrationLock, MigrationRunner, ModularCacheManager, ModularPerformanceMonitor, MySQLDialect2 as MySQLDialect, NotImplementedError, POOL_DEFAULTS, POOL_DEFAULTS_LEGACY, PerformanceMonitor, PoolExhaustedError, PostgreSQLDialect2 as PostgreSQLDialect, QUERY_DEFAULTS, QueryContext, QueryError, QueryTimeoutError, RETRY_DEFAULTS, SIZE_UNITS, SQLDialect, SchemaBuilder, MySQLDialect as SchemaMySQLDialect, PostgreSQLDialect as SchemaPostgreSQLDialect, SeederLoader, SeederRunner, SelectBuilder, SmartCacheStrategy, TIME_UNITS, TableBuilder, TimeoutError, TransactionError, UpdateBuilder, ValidationError, WhereBuilder, avg, cacheKey, chunk, composeMiddleware, compress, count, createAdapter, createCacheInvalidationMiddleware, createCacheKeyPattern, createCacheMiddleware, createCachedAdapter, createCircuitBreakerMiddleware, createDeadlineMiddleware, createExpandContractHelper, createLoggingMiddleware, createMetricsMiddleware, createModularQueryBuilder, createQueryState, createRetryMiddleware, createTimeoutMiddleware, crypto, cursorPaginate, decompress, encryptRow, exists, generateCacheKey, generateUUID, getCompressionRatio, isCompressed, isDeleteResult, isInsertResult, isSelectResult, isUpdateResult, max, min, paginate, parseCacheKey, processDataForEncryption, processResultsForDecryption, registerAdapterFactory, retry, sanitizeCacheKey, shouldCompress, sql, sum, validateColumnName, validateConnectionConfig, validateSQL, validateTableName, whereBetweenDates, whereDate, whereDay, whereLastDays, whereMonth, whereToday, whereYear, whereYesterday, withTimeout };
|
|
10641
|
+
export { ANALYSIS_DEFAULTS, AlterTableBuilder, BaseAdapter, BaseQueryBuilder, BaseTransaction, CACHE_DEFAULTS, CONNECTION_DEFAULTS, CRYPTO_DEFAULTS, CacheAPI, CacheError, CacheKeyGenerator, CacheManager, CacheableQuery, CachedAdapter, CachedDBBridge, DBBridge as Client, ColumnBuilder, ConnectionError, CryptoAlgorithms, CryptoProvider, DBBridge2 as DBBridge, DBBridgeError, DBBridge3 as DBBridgeFactory, DEFAULT_POOL_CONFIG, DEFAULT_TIMEOUTS, DURATION_BUCKETS, DatabaseError, DefaultCacheStrategy, DeleteBuilder, DialectFactory, ExpandContractHelper, FileMigrationRunner, ForeignKeyBuilder, ForeignKeyChain, HEALTH_DEFAULTS, HealthChecker, ISOLATION_LEVELS, InsertBuilder, IsolationLevel, LOGGING_DEFAULTS, MetricsCollector, MiddlewareChain, MigrationLoader, MigrationLock, MigrationRunner, ModularCacheManager, ModularPerformanceMonitor, MySQLDialect2 as MySQLDialect, NotImplementedError, POOL_DEFAULTS, POOL_DEFAULTS_LEGACY, PerformanceMonitor, PoolExhaustedError, PostgreSQLDialect2 as PostgreSQLDialect, QUERY_DEFAULTS, QueryContext, QueryError, QueryTimeoutError, RETRY_DEFAULTS, SIZE_UNITS, SQLDialect, SchemaBuilder, MySQLDialect as SchemaMySQLDialect, PostgreSQLDialect as SchemaPostgreSQLDialect, SeederLoader, SeederRunner, SelectBuilder, SmartCacheStrategy, TIME_UNITS, TableBuilder, TimeoutError, TransactionError, TypeGenerator, UpdateBuilder, ValidationError, WhereBuilder, avg, cacheKey, chunk, composeMiddleware, compress, count, createAdapter, createCacheInvalidationMiddleware, createCacheKeyPattern, createCacheMiddleware, createCachedAdapter, createCircuitBreakerMiddleware, createDeadlineMiddleware, createExpandContractHelper, createLoggingMiddleware, createMetricsMiddleware, createModularQueryBuilder, createQueryState, createRetryMiddleware, createTimeoutMiddleware, crypto, cursorPaginate, decompress, encryptRow, exists, generateCacheKey, generateUUID, getCompressionRatio, isCompressed, isDeleteResult, isInsertResult, isSelectResult, isUpdateResult, max, min, paginate, parseCacheKey, processDataForEncryption, processResultsForDecryption, registerAdapterFactory, retry, sanitizeCacheKey, shouldCompress, sql, sum, validateColumnName, validateConnectionConfig, validateSQL, validateTableName, whereBetweenDates, whereDate, whereDay, whereLastDays, whereMonth, whereToday, whereYear, whereYesterday, withTimeout };
|
|
10328
10642
|
//# sourceMappingURL=index.js.map
|
|
10329
10643
|
//# sourceMappingURL=index.js.map
|