sourcebot/packages/db
Michael Sukkarieh 60a3528394
V4 (#311)
Sourcebot V4 introduces authentication, performance improvements and code navigation. Checkout the [migration guide](https://docs.sourcebot.dev/self-hosting/upgrade/v3-to-v4-guide) for information on upgrading your instance to v4.

### Changed
- [**Breaking Change**] Authentication is now required by default. Notes:
  - When setting up your instance, email / password login will be the default authentication provider.
  - The first user that logs into the instance is given the `owner` role. ([docs](https://docs.sourcebot.dev/docs/more/roles-and-permissions)).
  - Subsequent users can request to join the instance. The `owner` can approve / deny requests to join the instance via `Settings` > `Members` > `Pending Requests`.
  - If a user is approved to join the instance, they are given the `member` role.
  - Additional login providers, including email links and SSO, can be configured with additional environment variables. ([docs](https://docs.sourcebot.dev/self-hosting/configuration/authentication)).
- Clicking on a search result now takes you to the `/browse` view. Files can still be previewed by clicking the "Preview" button or holding `Cmd` / `Ctrl` when clicking on a search result. [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)

### Added
- [Sourcebot EE] Added search-based code navigation, allowing you to jump between symbol definition and references when viewing source files. [Read the documentation](https://docs.sourcebot.dev/docs/search/code-navigation). [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
- Added collapsible filter panel. [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)

### Fixed
- Improved scroll performance for large numbers of search results. [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
2025-05-28 16:08:42 -07:00
..
prisma V4 (#311) 2025-05-28 16:08:42 -07:00
src v3 effort (#158) 2025-03-31 22:34:42 -07:00
tools v3 effort (#158) 2025-03-31 22:34:42 -07:00
.gitignore v3 effort (#158) 2025-03-31 22:34:42 -07:00
package.json v3 effort (#158) 2025-03-31 22:34:42 -07:00
README.md v3 effort (#158) 2025-03-31 22:34:42 -07:00
tsconfig.json v3 effort (#158) 2025-03-31 22:34:42 -07:00

@sourcebot/db

This package contains the database schema (prisma/schema.prisma), migrations (prisma/migrations) and the client library for interacting with the database. Before making edits to the schema, please read about prisma's migration model to get an idea of how migrations work.

Tools

This library contains a /tools directory with a collection of tooling needed for database management. Notable tools are:

  • yarn tool:prisma - runs the prisma CLI with an additional required param --url, the connection URL of the database you want the command to run against. This tool is geared towards running commands against non-dev database like staging or prod since 1) it allows you to quickly switch between environments, and 2) connection URLs do not need to be persisted in a DATABASE_URL environment variable. Examples:
# Run prisma studio
yarn tool:prisma studio --url postgresql://username:password@url:5432/db_name

# Rollback a migration
yarn tool:prisma migrate resolve --rolled-back "migration_name" --url postgresql://username:password@url:5432/db_name
  • yarn tool:run-script - runs a script (located in the /tools/scripts directory) that performs some operations against the DB. This is useful for writing bespoke CRUD operations while still being type-safe and having all the perks of the prisma client lib.
# Run `migrate-duplicate-connections.ts`
yarn tool:run-script --script  migrate-duplicate-connections --url postgresql://username:password@url:5432/db_name