diff options
author | 2024-10-07 13:18:15 +0000 | |
---|---|---|
committer | 2024-10-07 13:18:15 +0000 | |
commit | c87ae80053605848b988984a3b89c29fc22e1d19 (patch) | |
tree | 32dbb2730fc28b47a8919029005bb4f99f29e907 | |
parent | 6e06e6ed4f1c983f842527d7e3561a45a4407777 (diff) | |
download | astro-c87ae80053605848b988984a3b89c29fc22e1d19.tar.gz astro-c87ae80053605848b988984a3b89c29fc22e1d19.tar.zst astro-c87ae80053605848b988984a3b89c29fc22e1d19.zip |
[ci] format
-rw-r--r-- | packages/db/src/core/cli/migration-queries.ts | 17 | ||||
-rw-r--r-- | packages/db/test/libsql-remote.test.js | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/packages/db/src/core/cli/migration-queries.ts b/packages/db/src/core/cli/migration-queries.ts index 42d00b2b1..bd6360665 100644 --- a/packages/db/src/core/cli/migration-queries.ts +++ b/packages/db/src/core/cli/migration-queries.ts @@ -1,4 +1,5 @@ import { stripVTControlCharacters } from 'node:util'; +import { LibsqlError } from '@libsql/client'; import deepDiff from 'deep-diff'; import { sql } from 'drizzle-orm'; import { SQLiteAsyncDialect } from 'drizzle-orm/sqlite-core'; @@ -36,7 +37,6 @@ import type { TextColumn, } from '../types.js'; import type { RemoteDatabaseInfo, Result } from '../utils.js'; -import { LibsqlError } from '@libsql/client'; const sqlite = new SQLiteAsyncDialect(); const genTempTableName = customAlphabet('abcdefghijklmnopqrstuvwxyz', 10); @@ -453,16 +453,19 @@ async function getDbCurrentSnapshot( return JSON.parse(res.snapshot); } catch (error) { // Don't handle errors that are not from libSQL - if (error instanceof LibsqlError && + if ( + error instanceof LibsqlError && // If the schema was never pushed to the database yet the table won't exist. // Treat a missing snapshot table as an empty table. - ( - // When connecting to a remote database in that condition - // the query will fail with the following error code and message. - (error.code === 'SQLITE_UNKNOWN' && error.message === 'SQLITE_UNKNOWN: SQLite error: no such table: _astro_db_snapshot') || + + // When connecting to a remote database in that condition + // the query will fail with the following error code and message. + ((error.code === 'SQLITE_UNKNOWN' && + error.message === 'SQLITE_UNKNOWN: SQLite error: no such table: _astro_db_snapshot') || // When connecting to a local or in-memory database that does not have a snapshot table yet // the query will fail with the following error code and message. - (error.code === 'SQLITE_ERROR' && error.message === 'SQLITE_ERROR: no such table: _astro_db_snapshot')) + (error.code === 'SQLITE_ERROR' && + error.message === 'SQLITE_ERROR: no such table: _astro_db_snapshot')) ) { return; } diff --git a/packages/db/test/libsql-remote.test.js b/packages/db/test/libsql-remote.test.js index db0995a7b..ca5c021ae 100644 --- a/packages/db/test/libsql-remote.test.js +++ b/packages/db/test/libsql-remote.test.js @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; -import { relative } from 'node:path'; import { rm } from 'node:fs/promises'; +import { relative } from 'node:path'; import { after, before, describe, it } from 'node:test'; import { fileURLToPath } from 'node:url'; import testAdapter from '../../astro/test/test-adapter.js'; |