Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions packages/cli/src/commands/migrations/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ export default class Command extends CmaClientCommand {
!!primaryEnv && primaryEnv.id === destinationEnvId;

this.log(
`Migrations will be run in "${destinationEnvId}" ${
`Migrations will be ${
dryRun ? 'simulated (dry run)' : 'run'
} in "${destinationEnvId}" ${
destinationIsPrimary ? 'primary' : 'sandbox'
} environment`,
);
Expand Down Expand Up @@ -217,7 +219,9 @@ export default class Command extends CmaClientCommand {
this.log(
migrationScriptsToRun.length === 0
? 'No new migration scripts to run, skipping operation'
: `Successfully run ${migrationScriptsToRun.length} migration scripts`,
: dryRun
? `Successfully simulated ${migrationScriptsToRun.length} migration scripts (dry run, no changes were made)`
: `Successfully run ${migrationScriptsToRun.length} migration scripts`,
);

return {
Expand All @@ -237,7 +241,11 @@ export default class Command extends CmaClientCommand {
) {
const relativePath = relative(migrationsDir, script.path);

this.startSpinner(`Running migration "${relativePath}"`);
this.startSpinner(
dryRun
? `Simulating migration "${relativePath}" (dry run)`
: `Running migration "${relativePath}"`,
);

try {
if (!dryRun) {
Expand Down Expand Up @@ -337,7 +345,11 @@ export default class Command extends CmaClientCommand {
) {
try {
this.startSpinner(
`Creating a fork of "${sourceEnv.id}" environment called "${destinationEnvId}"`,
`Creating a fork of "${
sourceEnv.id
}" environment called "${destinationEnvId}"${
dryRun ? ' (dry run, skipped)' : ''
}`,
);

const existingEnvironment = allEnvironments.find(
Expand Down Expand Up @@ -412,7 +424,11 @@ export default class Command extends CmaClientCommand {
return await client.itemTypes.find(migrationModelApiKey);
} catch (e) {
if (e instanceof CmaClient.ApiError && e.response.status === 404) {
this.startSpinner(`Creating "${migrationModelApiKey}" model`);
this.startSpinner(
`Creating "${migrationModelApiKey}" model${
dryRun ? ' (dry run, skipped)' : ''
}`,
);

let migrationItemType: CmaClient.ApiTypes.ItemType | null = null;

Expand Down