Merge pull request #119 from bknd-io/fix/cf-d1-introspect-issue-2

fix d1 introspect issue by excluding `_cf_METADATA`
This commit is contained in:
dswbx
2025-03-26 09:59:38 +01:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
"type": "module",
"sideEffects": false,
"bin": "./dist/cli/index.js",
"version": "0.10.0",
"version": "0.10.2",
"description": "Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.",
"homepage": "https://bknd.io",
"repository": {

View File

@@ -28,6 +28,10 @@ export class SqliteIntrospector extends BaseIntrospector {
}
async getSchemaSpec() {
const ext = this.getExcludedTableNames()
.map((it) => `'${it}'`)
.join(", ");
const query = sql`
SELECT m.name, m.type, m.sql,
(SELECT json_group_array(
@@ -56,7 +60,7 @@ export class SqliteIntrospector extends BaseIntrospector {
FROM sqlite_master m
WHERE m.type IN ('table', 'view')
and m.name not like 'sqlite_%'
and m.name not in (${this.getExcludedTableNames().join(", ")})
and m.name not in (${sql.raw(ext)})
`;
const tables = await this.executeWithPlugins<SqliteSchemaSpec[]>(query);