Add flexible driver configuration for organization databases#1176
Closed
Add flexible driver configuration for organization databases#1176
Conversation
- Add DriverConfig discriminated union supporting 5 driver types - Support Turso, Memory, SQL, SQLite, and Custom drivers - Update TenantDatabase schema to use driverConfig instead of hardcoded Turso fields - Update TenantProvisioningService with driver-specific provisioning methods - Add DriverFactory for runtime driver instance management - Update TenantContextService with getDriverForOrganization() method - Update sys_tenant_database object schema to store driver_config - Enable flexible deployment scenarios (dev/test/prod/enterprise) Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/ad2ea41d-bf29-42ea-af00-fcc7d6deea5f Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
- Add multi-driver.test.ts with tests for all 5 driver types - Add driver-factory.test.ts with cache key tests - Add DRIVER_CONFIG.md with complete usage guide - Document migration path from hardcoded Turso - Include examples for dev/staging/prod scenarios - Add type safety and troubleshooting sections Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/ad2ea41d-bf29-42ea-af00-fcc7d6deea5f Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Claude created this pull request from a session on behalf of
hotlong
April 17, 2026 09:16
View session
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Copilot stopped work on behalf of
hotlong due to an error
April 17, 2026 10:37
Copilot stopped work on behalf of
hotlong due to an error
April 17, 2026 12:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Organizations can now specify their database driver type (Turso, Memory, SQL, SQLite, Custom) instead of being limited to hardcoded Turso configuration. This enables flexible deployment scenarios: memory drivers for development/testing, Turso for production cloud, PostgreSQL/MySQL for enterprise on-premise, and custom drivers for proprietary implementations.
Changes
Schema Updates (
packages/spec/src/cloud/tenant.zod.ts)DriverConfigSchemadiscriminated union supporting 5 driver typesTursoDriverConfigSchema,MemoryDriverConfigSchema,SQLDriverConfigSchema,SQLiteDriverConfigSchema,CustomDriverConfigSchemaTenantDatabaseSchemato usedriverConfigfield instead of separatedatabaseName,databaseUrl,authToken,regionfieldsProvisionTenantRequestSchemato acceptdriverConfigparameterProvisioning Service (
packages/services/service-tenant/src/tenant-provisioning.ts)provisionTenant()to dispatch based on driver typeprovisionTursoDatabase(),provisionMemoryDriver(),provisionSQLDatabase(),provisionSQLiteDatabase(),provisionCustomDriver()storeTenantRecord()to serializedriverConfigas JSONDriver Factory (
packages/services/service-tenant/src/driver-factory.ts)DriverFactoryclass for managing driver instances with cachingRuntime Resolution (
packages/services/service-tenant/src/tenant-context.ts)getDriverForOrganization()method to retrieve driver instance for an organizationgetTenantDatabase()to query control plane for driver configurationDriverFactoryfor runtime driver creationDatabase Schema (
packages/services/service-tenant/src/objects/sys-tenant-database.object.ts)driver_configtextarea field storing JSON-serialized configurationUsage Example
Testing
Added comprehensive test coverage:
multi-driver.test.ts: Integration tests for all 5 driver typesdriver-factory.test.ts: Cache key generation and management testsDocumentation
DRIVER_CONFIG.md: Complete usage guide with migration path, best practices, and troubleshooting