typebase-io-cli db
Manage your database schema.
Last updated on
Push your Drizzle schema changes to your database.
db dev push
Push your schema to the dev Neon database.
npx typebase-io-cli db dev pushdb prod push
Push your schema to the production Neon database.
npx typebase-io-cli db prod pushdb local push
Push your schema to a Postgres instance running on your own machine (Docker, Postgres.app, a managed Postgres you connect to directly, etc.).
Pass the connection string with --url:
npx typebase-io-cli db local push --url postgres://localhost:5432/mydbOr set DATABASE_URL (in your shell or in your project-root .env) and omit the flag:
npx typebase-io-cli db local pushWhat happens
These commands:
- Build your schema files
- Connect to your database
- Push the schema changes using Drizzle Kit
db push applies schema changes directly to the database. Additive changes (new tables, new columns) are safe, but destructive changes (dropped
columns, renamed tables) cannot be undone. The CLI will detect these and prompt for confirmation before continuing. Treat db prod push with extra
care since dropped data is unrecoverable.