mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
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:
@@ -3,7 +3,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"bin": "./dist/cli/index.js",
|
"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.",
|
"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",
|
"homepage": "https://bknd.io",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ export class SqliteIntrospector extends BaseIntrospector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getSchemaSpec() {
|
async getSchemaSpec() {
|
||||||
|
const ext = this.getExcludedTableNames()
|
||||||
|
.map((it) => `'${it}'`)
|
||||||
|
.join(", ");
|
||||||
|
|
||||||
const query = sql`
|
const query = sql`
|
||||||
SELECT m.name, m.type, m.sql,
|
SELECT m.name, m.type, m.sql,
|
||||||
(SELECT json_group_array(
|
(SELECT json_group_array(
|
||||||
@@ -56,7 +60,7 @@ export class SqliteIntrospector extends BaseIntrospector {
|
|||||||
FROM sqlite_master m
|
FROM sqlite_master m
|
||||||
WHERE m.type IN ('table', 'view')
|
WHERE m.type IN ('table', 'view')
|
||||||
and m.name not like 'sqlite_%'
|
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);
|
const tables = await this.executeWithPlugins<SqliteSchemaSpec[]>(query);
|
||||||
|
|||||||
Reference in New Issue
Block a user