@ductape/cli 0.2.11 → 0.2.13
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/dist/commands/db-schema.d.ts +1 -0
- package/dist/commands/db-schema.js +2 -1
- package/dist/index.js +2 -1
- package/dist/lib/integrations.d.ts +1 -0
- package/dist/lib/integrations.js +1 -0
- package/package.json +1 -1
- package/src/commands/db-schema.ts +3 -1
- package/src/index.ts +2 -1
- package/src/lib/integrations.ts +2 -0
|
@@ -5,6 +5,7 @@ interface SchemaGenerateOpts {
|
|
|
5
5
|
export declare function runDbSchemaGenerate(opts: SchemaGenerateOpts): Promise<void>;
|
|
6
6
|
interface SchemaPushOpts {
|
|
7
7
|
db: string;
|
|
8
|
+
env: string;
|
|
8
9
|
}
|
|
9
10
|
export declare function runDbSchemaPush(opts: SchemaPushOpts): Promise<void>;
|
|
10
11
|
export {};
|
|
@@ -353,7 +353,7 @@ function adaptColumn(col) {
|
|
|
353
353
|
export async function runDbSchemaPush(opts) {
|
|
354
354
|
const session = requireSession();
|
|
355
355
|
const proxy = getDbProxy(session);
|
|
356
|
-
const envSlug =
|
|
356
|
+
const envSlug = opts.env;
|
|
357
357
|
const productTag = session.project.product_tag;
|
|
358
358
|
const dbContext = { database: opts.db, env: envSlug, product: productTag };
|
|
359
359
|
console.log(`Connecting to database "${opts.db}" (env: ${envSlug})...`);
|
|
@@ -403,6 +403,7 @@ export async function runDbSchemaPush(opts) {
|
|
|
403
403
|
workspace_id: session.project.workspace_id,
|
|
404
404
|
product_tag: productTag,
|
|
405
405
|
database_tag: opts.db,
|
|
406
|
+
env_slug: envSlug,
|
|
406
407
|
table_schemas: tableSchemas,
|
|
407
408
|
});
|
|
408
409
|
console.log(`Done. Synced ${result.synced} table(s): ${result.tables.join(', ')}`);
|
package/dist/index.js
CHANGED
|
@@ -309,7 +309,8 @@ dbSchema
|
|
|
309
309
|
.command('push')
|
|
310
310
|
.description('Read live table schema from the database and sync it to the Ductape server (enables AI field guidance)')
|
|
311
311
|
.requiredOption('--db <tag>', 'Database tag to sync')
|
|
312
|
-
.
|
|
312
|
+
.requiredOption('--env <slug>', 'Environment slug (e.g. snd, prd) whose live database to read from')
|
|
313
|
+
.action(wrap((opts) => runDbSchemaPush({ db: opts.db, env: opts.env })));
|
|
313
314
|
db
|
|
314
315
|
.argument('[verb]', 'connect | query | …')
|
|
315
316
|
.option('-f, --file <path>')
|
package/dist/lib/integrations.js
CHANGED
package/package.json
CHANGED
|
@@ -340,6 +340,7 @@ function requireSilent(): ReturnType<typeof requireSession> | null {
|
|
|
340
340
|
|
|
341
341
|
interface SchemaPushOpts {
|
|
342
342
|
db: string;
|
|
343
|
+
env: string;
|
|
343
344
|
}
|
|
344
345
|
|
|
345
346
|
function adaptColumn(col: Record<string, unknown>): TableColumnRecord {
|
|
@@ -357,7 +358,7 @@ function adaptColumn(col: Record<string, unknown>): TableColumnRecord {
|
|
|
357
358
|
export async function runDbSchemaPush(opts: SchemaPushOpts): Promise<void> {
|
|
358
359
|
const session = requireSession();
|
|
359
360
|
const proxy = getDbProxy(session);
|
|
360
|
-
const envSlug =
|
|
361
|
+
const envSlug = opts.env;
|
|
361
362
|
const productTag = session.project.product_tag;
|
|
362
363
|
const dbContext = { database: opts.db, env: envSlug, product: productTag };
|
|
363
364
|
|
|
@@ -419,6 +420,7 @@ export async function runDbSchemaPush(opts: SchemaPushOpts): Promise<void> {
|
|
|
419
420
|
workspace_id: session.project.workspace_id,
|
|
420
421
|
product_tag: productTag,
|
|
421
422
|
database_tag: opts.db,
|
|
423
|
+
env_slug: envSlug,
|
|
422
424
|
table_schemas: tableSchemas,
|
|
423
425
|
});
|
|
424
426
|
|
package/src/index.ts
CHANGED
|
@@ -402,7 +402,8 @@ dbSchema
|
|
|
402
402
|
.command('push')
|
|
403
403
|
.description('Read live table schema from the database and sync it to the Ductape server (enables AI field guidance)')
|
|
404
404
|
.requiredOption('--db <tag>', 'Database tag to sync')
|
|
405
|
-
.
|
|
405
|
+
.requiredOption('--env <slug>', 'Environment slug (e.g. snd, prd) whose live database to read from')
|
|
406
|
+
.action(wrap((opts) => runDbSchemaPush({ db: opts.db, env: opts.env })));
|
|
406
407
|
|
|
407
408
|
db
|
|
408
409
|
.argument('[verb]', 'connect | query | …')
|
package/src/lib/integrations.ts
CHANGED
|
@@ -69,6 +69,7 @@ export async function pushDatabaseSchema(
|
|
|
69
69
|
workspace_id: string;
|
|
70
70
|
product_tag: string;
|
|
71
71
|
database_tag: string;
|
|
72
|
+
env_slug: string;
|
|
72
73
|
table_schemas: TableSchemaRecord[];
|
|
73
74
|
},
|
|
74
75
|
): Promise<{ synced: number; tables: string[] }> {
|
|
@@ -84,6 +85,7 @@ export async function pushDatabaseSchema(
|
|
|
84
85
|
workspace_id: opts.workspace_id,
|
|
85
86
|
product_tag: opts.product_tag,
|
|
86
87
|
database_tag: opts.database_tag,
|
|
88
|
+
env_slug: opts.env_slug,
|
|
87
89
|
table_schemas: opts.table_schemas,
|
|
88
90
|
}),
|
|
89
91
|
});
|