0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-06 22:10:10 -05:00

[ci] format

This commit is contained in:
Fred K. Schott 2024-03-05 19:45:27 +00:00 committed by astrobot-houston
parent 24bc169070
commit e1477bb3d6
3 changed files with 8 additions and 7 deletions

View file

@ -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 {

View file

@ -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();

View file

@ -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);