From 6e55d7e9a64e9e40a331358d9fb1da22ecaab2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rom=C3=A1n=20Benj=C3=A1min?= Date: Sun, 1 Mar 2026 20:56:53 +0100 Subject: [PATCH] fix(cli): exclude Prisma migrations from SQLite pull Filters out the internal migration tracking table during the introspection process. This prevents the CLI from including system-level metadata in the generated schema, ensuring only user-defined tables and views are processed. --- packages/cli/src/actions/pull/provider/sqlite.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/actions/pull/provider/sqlite.ts b/packages/cli/src/actions/pull/provider/sqlite.ts index c4b06f367..435da9766 100644 --- a/packages/cli/src/actions/pull/provider/sqlite.ts +++ b/packages/cli/src/actions/pull/provider/sqlite.ts @@ -134,10 +134,11 @@ export const sqlite: IntrospectionProvider = { // List user tables and views from sqlite_schema (the master catalog). // sqlite_schema contains one row per table, view, index, and trigger. - // We filter to only tables/views and exclude internal sqlite_* objects. + // We filter to only tables/views and exclude internal sqlite_* objects + // and the Prisma migration tracking table. // The 'sql' column contains the original CREATE TABLE/VIEW statement. const tablesRaw = all<{ name: string; type: 'table' | 'view'; definition: string | null }>( - "SELECT name, type, sql AS definition FROM sqlite_schema WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%' ORDER BY name", + "SELECT name, type, sql AS definition FROM sqlite_schema WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%' AND name <> '_prisma_migrations' ORDER BY name", ); // Detect AUTOINCREMENT by parsing the CREATE TABLE statement