Skip to content

refactor(database): unify PostgreSQL/SQLite schemas via dialect shim#32256

Closed
jadsongmatos wants to merge 2 commits into
anomalyco:devfrom
jadsongmatos:clean-dialect-shim-v2
Closed

refactor(database): unify PostgreSQL/SQLite schemas via dialect shim#32256
jadsongmatos wants to merge 2 commits into
anomalyco:devfrom
jadsongmatos:clean-dialect-shim-v2

Conversation

@jadsongmatos

Copy link
Copy Markdown

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:

    • 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

Testing

  • Typecheck: clean
  • Tests: 25/25 pass in project.test.ts

Closes #14212

…(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
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Duplicate PRs Found

PR #32255: #32255
PR #32254: #32254

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.

@github-actions

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 14, 2026
@github-actions github-actions Bot closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Support more DBMS' for OpenCode state storage

1 participant