Skip to content

feat(db): add subpath exports for db, operators, and all schema files - #1107

Merged
2witstudios merged 2 commits into
masterfrom
pu/barrel-db-setup
Apr 24, 2026
Merged

2witstudios merged 2 commits into
masterfrom
pu/barrel-db-setup

Conversation

@2witstudios

@2witstudios 2witstudios commented Apr 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Extracts the drizzle db instance from `src/index.ts` into its own `src/db.ts` file
  • Creates `src/operators.ts` that re-exports all drizzle-orm operators and types (canonical source — `index.ts` re-exports from it, eliminating ordering drift)
  • Adds `./db`, `./operators`, `./schema` (combined barrel), and `./schema/` subpath exports to `package.json` for all 32 schema files
  • Root `"."` export is preserved for backward compatibility
  • `DATABASE_SSL=true` env var opts into SSL for the connection pool (was hardcoded `false`)

Context

This is Agent 1 of 4 — the foundation PR in a series eliminating all ~290 remaining `@pagespace/db` barrel imports across the monorepo. The three follow-on PRs (packages/lib, apps/web, and small apps + ESLint config) depend on these subpath exports existing before they can land.

Merge order: this PR → packages/lib PR → apps/web PR → small apps PR

Subpath exports added

Export Source
`@pagespace/db/db` `src/db.ts` — drizzle client instance
`@pagespace/db/operators` `src/operators.ts` — eq, and, or, sql, etc.
`@pagespace/db/schema` `src/schema.ts` — combined Drizzle schema barrel
`@pagespace/db/schema/ai` … `@pagespace/db/schema/workflows` 32 individual schema files

Test plan

  • `pnpm --filter @pagespace/db build` exits 0
  • `dist/db.js`, `dist/operators.js`, `dist/schema.js` and all `dist/schema/*.js` files present after build
  • `pnpm --filter @pagespace/db typecheck` exits 0
  • Root `"."` export unchanged — no breaking changes to existing consumers

🤖 Generated with Claude Code

Extracts the drizzle db instance into src/db.ts and drizzle operator
re-exports into src/operators.ts, then registers ./db, ./operators, and
./schema/<name> subpath exports in package.json for all 32 schema files.
Prerequisite for three follow-on PRs that eliminate @pagespace/db barrel
imports across packages/lib, apps/web, and small apps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@2witstudios has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 26 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 44 minutes and 26 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1683fe08-5acd-41e5-ae58-bc5d31ed4e20

📥 Commits

Reviewing files that changed from the base of the PR and between 1f74533 and 3f0f7c6.

📒 Files selected for processing (4)
  • packages/db/package.json
  • packages/db/src/db.ts
  • packages/db/src/index.ts
  • packages/db/src/operators.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pu/barrel-db-setup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…xport

- db.ts: ssl now reads DATABASE_SSL env var instead of hardcoded false
- index.ts: operators re-exported from ./operators (single source of truth)
- package.json: add ./schema subpath export for combined schema barrel

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@2witstudios
2witstudios merged commit 4a73d03 into master Apr 24, 2026
3 checks passed
@2witstudios
2witstudios deleted the pu/barrel-db-setup branch April 24, 2026 17:47
2witstudios added a commit that referenced this pull request May 15, 2026
…#1107)

* feat(db): add subpath exports for db, operators, and all schema files

Extracts the drizzle db instance into src/db.ts and drizzle operator
re-exports into src/operators.ts, then registers ./db, ./operators, and
./schema/<name> subpath exports in package.json for all 32 schema files.
Prerequisite for three follow-on PRs that eliminate @pagespace/db barrel
imports across packages/lib, apps/web, and small apps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(db): env-configurable SSL, single operator source, add ./schema export

- db.ts: ssl now reads DATABASE_SSL env var instead of hardcoded false
- index.ts: operators re-exported from ./operators (single source of truth)
- package.json: add ./schema subpath export for combined schema barrel

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant