@ronin/cli
Advanced tools
Comparing version 0.2.38 to 0.2.39-corny-ron-1099-3-experimental-136
@@ -343,3 +343,4 @@ // src/index.ts | ||
local: { type: "boolean", short: "l", default: false }, | ||
apply: { type: "boolean", short: "a", default: false } | ||
apply: { type: "boolean", short: "a", default: false }, | ||
choose: { type: "boolean", short: "c", default: false } | ||
}; | ||
@@ -1480,11 +1481,18 @@ | ||
const migrations = fs6.readdirSync(MIGRATIONS_PATH); | ||
const migrationPrompt = migrationFilePath ?? await select3({ | ||
const sortedMigrations = migrations.sort((a, b) => b.localeCompare(a)); | ||
const migrationPrompt = migrationFilePath ?? (flags.choose ? await select3({ | ||
message: "Which migration do you want to apply?", | ||
choices: migrations.sort((a, b) => b.localeCompare(a)).map((migration) => ({ | ||
choices: sortedMigrations.map((migration) => ({ | ||
name: migration, | ||
value: path5.join(MIGRATIONS_PATH, migration) | ||
})) | ||
}); | ||
}) : path5.join(MIGRATIONS_PATH, sortedMigrations[0])); | ||
const protocol = await new Protocol(packages).load(migrationPrompt); | ||
const statements = protocol.getSQLStatements(existingModels); | ||
const statements = protocol.getSQLStatements( | ||
existingModels.map((model) => ({ | ||
...model, | ||
// @ts-expect-error This will work once the types are fixed. | ||
fields: convertArrayToObject(model.fields) | ||
})) | ||
); | ||
if (!fs6.existsSync(MIGRATIONS_PATH)) { | ||
@@ -1840,2 +1848,3 @@ fs6.mkdirSync(MIGRATIONS_PATH, { recursive: true }); | ||
-d, --debug Shows additional debugging information | ||
-c, --choose Choose the migration to apply | ||
`; | ||
@@ -1842,0 +1851,0 @@ console.log(text); |
{ | ||
"name": "@ronin/cli", | ||
"version": "0.2.38", | ||
"version": "0.2.39-corny-ron-1099-3-experimental-136", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "The command-line interface for RONIN.", |
77458
1885