diff options
author | 2024-03-05 19:45:27 +0000 | |
---|---|---|
committer | 2024-03-05 19:45:27 +0000 | |
commit | e1477bb3d6287f4184db639ad553fce5bfb259fc (patch) | |
tree | 41ccaa3d66295674a02fa537b0a150b5eebba695 | |
parent | 24bc1690700709392b2c0c60222e885fc54b145a (diff) | |
download | astro-e1477bb3d6287f4184db639ad553fce5bfb259fc.tar.gz astro-e1477bb3d6287f4184db639ad553fce5bfb259fc.tar.zst astro-e1477bb3d6287f4184db639ad553fce5bfb259fc.zip |
[ci] format
-rw-r--r-- | packages/db/src/core/cli/commands/push/index.ts | 4 | ||||
-rw-r--r-- | packages/db/src/core/cli/commands/verify/index.ts | 5 | ||||
-rw-r--r-- | packages/db/src/core/cli/migration-queries.ts | 6 |
3 files changed, 8 insertions, 7 deletions
diff --git a/packages/db/src/core/cli/commands/push/index.ts b/packages/db/src/core/cli/commands/push/index.ts index f7359a8b3..3e08de7b9 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 4bf8683b9..a83194599 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 f1b1047cb..130b53889 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); |