Skip to content

Commit 2147c57

Browse files
authored
Merge pull request #951 from objectstack-ai/copilot/migrate-driver-sql-plugin
2 parents 84042de + cdd1bd1 commit 2147c57

13 files changed

+2768
-55
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- **`@objectstack/driver-sql` plugin** — Migrated the Knex-based SQL driver from `@objectql/driver-sql`
12+
into `packages/plugins/driver-sql/`. The driver implements the standard `DriverInterface` from
13+
`@objectstack/core` and imports types from `@objectstack/spec/data`. Supports PostgreSQL, MySQL,
14+
and SQLite (via `better-sqlite3`). Includes schema sync, introspection, aggregation, window
15+
functions, transactions, and full CRUD with both QueryAST and legacy filter format support.
16+
All 72 unit tests pass against in-memory SQLite.
17+
1018
### Changed
1119
- **Migrate API layer to Hono + Vercel Node adapter** — Replaced the vestigial Next.js-style
1220
`api/[...path].ts` catch-all with a proper `api/index.ts` Hono entrypoint using `handle(app)`

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@
5252
"pnpm": {
5353
"overrides": {
5454
"minimatch@<10.2.1": "10.2.1"
55-
}
55+
},
56+
"ignoredBuiltDependencies": [
57+
"@nestjs/core",
58+
"@prisma/engines",
59+
"@vscode/vsce-sign",
60+
"keytar",
61+
"prisma",
62+
"yarn"
63+
]
5664
}
5765
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "@objectstack/driver-sql",
3+
"version": "3.2.9",
4+
"license": "Apache-2.0",
5+
"description": "SQL Driver for ObjectStack - Supports PostgreSQL, MySQL, SQLite via Knex",
6+
"main": "dist/index.js",
7+
"types": "dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"types": "./dist/index.d.ts",
11+
"import": "./dist/index.mjs",
12+
"require": "./dist/index.js"
13+
}
14+
},
15+
"scripts": {
16+
"build": "tsup --config ../../../tsup.config.ts",
17+
"dev": "tsc -w",
18+
"test": "vitest run"
19+
},
20+
"dependencies": {
21+
"@objectstack/core": "workspace:*",
22+
"@objectstack/spec": "workspace:*",
23+
"knex": "^3.1.0",
24+
"nanoid": "^3.3.11"
25+
},
26+
"devDependencies": {
27+
"@types/node": "^25.5.0",
28+
"better-sqlite3": "^11.9.1",
29+
"typescript": "^5.0.0",
30+
"vitest": "^4.1.0"
31+
}
32+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import { SqlDriver } from './sql-driver.js';
4+
5+
export { SqlDriver };
6+
export type {
7+
SqlDriverConfig,
8+
IntrospectedSchema,
9+
IntrospectedTable,
10+
IntrospectedColumn,
11+
IntrospectedForeignKey,
12+
} from './sql-driver.js';
13+
14+
export default {
15+
id: 'com.objectstack.driver.sql',
16+
version: '1.0.0',
17+
18+
onEnable: async (context: any) => {
19+
const { logger, config, drivers } = context;
20+
logger.info('[SQL Driver] Initializing...');
21+
22+
if (drivers) {
23+
const driver = new SqlDriver(config);
24+
drivers.register(driver);
25+
logger.info(`[SQL Driver] Registered driver: ${driver.name}`);
26+
} else {
27+
logger.warn('[SQL Driver] No driver registry found in context.');
28+
}
29+
},
30+
};

0 commit comments

Comments
 (0)