diff --git a/packages/db/src/core/cli/commands/push/index.ts b/packages/db/src/core/cli/commands/push/index.ts index f7359a8b3b..3e08de7b91 100644 --- a/packages/db/src/core/cli/commands/push/index.ts +++ b/packages/db/src/core/cli/commands/push/index.ts @@ -1,4 +1,5 @@ import type { AstroConfig } from 'astro'; +import { red } from 'kleur/colors'; import type { Arguments } from 'yargs-parser'; import { getManagedAppTokenOrExit } from '../../../tokens.js'; import { type DBConfig, type DBSnapshot } from '../../../types.js'; @@ -10,7 +11,6 @@ import { getMigrationQueries, getProductionCurrentSnapshot, } from '../../migration-queries.js'; -import { red } from 'kleur/colors'; export async function cmd({ dbConfig, @@ -44,7 +44,7 @@ export async function cmd({ console.log('\n' + formatDataLossMessage(confirmations) + '\n'); throw new Error('Exiting.'); } - + if (isDryRun) { console.log('Statements:', JSON.stringify(migrationQueries, undefined, 2)); } else { diff --git a/packages/db/src/core/cli/commands/verify/index.ts b/packages/db/src/core/cli/commands/verify/index.ts index 4bf8683b9d..a83194599f 100644 --- a/packages/db/src/core/cli/commands/verify/index.ts +++ b/packages/db/src/core/cli/commands/verify/index.ts @@ -37,8 +37,7 @@ export async function cmd({ result.message = `Database schema is out of date.\nRun 'astro db push' to push up your latest changes.`; } - - if (confirmations.length > 0) { + if (confirmations.length > 0) { result.code = 'DATA_LOSS'; result.exitCode = 1; result.data = confirmations; @@ -48,7 +47,7 @@ export async function cmd({ if (isJson) { console.log(JSON.stringify(result)); } else { - console.log(result.message); + console.log(result.message); } await appToken.destroy(); diff --git a/packages/db/src/core/cli/migration-queries.ts b/packages/db/src/core/cli/migration-queries.ts index f1b1047cb7..130b538894 100644 --- a/packages/db/src/core/cli/migration-queries.ts +++ b/packages/db/src/core/cli/migration-queries.ts @@ -1,8 +1,8 @@ -import stripAnsi from 'strip-ansi'; import deepDiff from 'deep-diff'; import { SQLiteAsyncDialect } from 'drizzle-orm/sqlite-core'; import * as color from 'kleur/colors'; import { customAlphabet } from 'nanoid'; +import stripAnsi from 'strip-ansi'; import { hasPrimaryKey } from '../../runtime/index.js'; import { getCreateIndexQueries, @@ -451,7 +451,9 @@ export function formatDataLossMessage(confirmations: string[], isColor = true): messages.push(...confirmations.map((m, i) => color.red(` (${i + 1}) `) + m)); messages.push(``); messages.push(`To resolve, revert these changes or update your schema, and re-run the command.`); - messages.push(`You may also run 'astro db push --force-reset' to ignore all warnings and force-push your local database schema to production instead. All data will be lost and the database will be reset.`); + messages.push( + `You may also run 'astro db push --force-reset' to ignore all warnings and force-push your local database schema to production instead. All data will be lost and the database will be reset.` + ); let finalMessage = messages.join('\n'); if (!isColor) { finalMessage = stripAnsi(finalMessage);