refactor(database): unify PostgreSQL/SQLite schemas via dialect shim#32256
refactor(database): unify PostgreSQL/SQLite schemas via dialect shim#32256jadsongmatos wants to merge 2 commits into
Conversation
…(wgzesg/feat/configurable-database-backend)
- Add dialect shim (dialect.ts, dialect.sqlite.ts, dialect.pg.ts) with type mappings:
text({mode:'json'})→jsonb(), integer()→bigint({mode:'number'}), integer({mode:'boolean'})→boolean(), real()→doublePrecision()
- Migrate 9 sql.ts files to import from shim, removing isPostgres() dispatch and .pg.ts duplicates:
credential, account, permission, event, share, project, data-migration, control-plane/workspace, session
- Remove 10 .pg.ts files + schema.sql.ts, schema.pg.ts, path.pg.ts, pg-bootstrap.ts
- Simplify tables.ts (no dispatch), migration.ts (no pg-bootstrap), path.ts (customType from shim), schema.ts (re-export Timestamps)
- Fix project.test.ts: imports, fs.promises.realpath, ProjectV2.Directories test data, withRepo remote
- database.ts retains DatabaseDialect.isPostgres() for runtime driver selection (correct)
Implements dialect shim pattern from wgzesg/opencode#feat/configurable-database-backend
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Duplicate PRs FoundPR #32255: #32255 Both have the identical title and appear to address the same database refactoring work. These are likely duplicates of the current PR #32256. Consider consolidating these PRs or verifying which one should be the canonical version to merge. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Implements dialect shim pattern (from wgzesg/feat/configurable-database-backend) to unify PostgreSQL and SQLite schemas without duplicate .pg.ts files.
Changes
Add dialect shim (dialect.ts, dialect.sqlite.ts, dialect.pg.ts) with type mappings:
Migrate 9 sql.ts files to import from shim, removing isPostgres() dispatch and .pg.ts duplicates:
Remove 10 .pg.ts files + schema.sql.ts, schema.pg.ts, path.pg.ts, pg-bootstrap.ts
Simplify tables.ts (no dispatch), migration.ts (no pg-bootstrap), path.ts (customType from shim), schema.ts (re-export Timestamps)
Fix project.test.ts: imports, fs.promises.realpath, ProjectV2.Directories test data, withRepo remote
Testing
Closes #14212