Database
The database is a key component of any application. It is where you store and retrieve data. Turboship uses Drizzle ORM as the default database solution. Drizzle ORM is a lightweight, high-performance ORM for Typescript applications. It is designed to work with any SQL database and supports MySQL, PostgreSQL, and SQLite.
Turboship's database definitions are inside the folder packages/db
. It comes
with the following scripts that you can run from the database folder:
generate
: Generate the database migration file.studio
: Open the database studio.deploy
: Apply the database migrations.seed
: Seed the database with the initial data. Seepackages/db/src/seed.ts
.push
: Push the changes to the database without generating the migration file.reset
: Reset the database to the initial state.
So during development, you just need run the following commands:
bun run --cwd packages/db push
After you have made changes to the database schema, you can generate the migration file by running:
bun run --cwd packages/db generate