Skip to content

Conversation

@sitole
Copy link
Member

@sitole sitole commented Oct 16, 2025

Move all database package files under the pkg module to make it cleaner and Go-compliant.
Requested at #1365


Note

Relocates the database module to packages/db/pkg and updates imports, sqlc outputs, Dockerfiles, and env handling in the DB client across the codebase.

  • DB package:
    • Move sources to packages/db/pkg (e.g., pkg/client, pkg/queries, pkg/types); update sqlc.yaml outputs to pkg/queries and type overrides to pkg/types.
    • Change pkg/client.NewClient to read POSTGRES_CONNECTION_STRING via os.Getenv and error if unset.
    • Update packages/db/Dockerfile to build migrator from cmd/migrator; adjust paths; slim builder.
    • Update packages/db/Makefile generate target to pkg/queries.
    • Refresh packages/db/go.mod deps; add/remove indirects.
  • API and services:
    • Update all imports from db/{client,queries,types,dberrors} to db/pkg/{client,queries,types,dberrors} across handlers, orchestrator, template-manager, utils, cache, edge pool, and team modules.
    • Adjust packages/api/Dockerfile to copy ./db/pkg instead of individual subdirs.
  • Seeds/Tests/Shared:
    • Update seed scripts and integration tests to new db/pkg/* imports.
    • Add replace github.com/e2b-dev/infra/packages/db => ../db in packages/shared/go.mod.
  • Generated code:
    • Regenerate sqlc files under packages/db/pkg/queries with updated package paths.

Written by Cursor Bugbot for commit 3b61f99. This will update automatically on new commits. Configure here.

@sitole sitole added the improvement Improvement for current functionality label Oct 16, 2025
@sitole sitole marked this pull request as ready for review October 16, 2025 16:11
@sitole sitole marked this pull request as draft October 16, 2025 16:34
@sitole
Copy link
Member Author

sitole commented Oct 16, 2025

Make tidy now complains about cycle dependency (shared - db - shared). Not sure why it was not an issue before.

@sitole
Copy link
Member Author

sitole commented Oct 17, 2025

Make tidy now complains about cycle dependency (shared - db - shared). Not sure why it was not an issue before.

The build fails because the shared dependency is now on the db package, and we need to add it to all Dockerfiles, even if the database is not used there. I don't like it, and we should move the seed database script out of shared, so it's not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement for current functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants