Skip to content

aerostack db

Manage D1 and Neon Postgres databases — create databases, run migrations, and pull schemas.

Terminal window
aerostack db migrate new <name>

Creates a timestamped SQL migration file in your migrations/ directory.

migrations/0001_add_users_table.sql
aerostack db migrate new add_users_table
Terminal window
# Apply locally (default)
aerostack db migrate apply
# Apply to remote staging
aerostack db migrate apply --remote staging
# Apply to remote production
aerostack db migrate apply --remote production
Terminal window
aerostack db migrate apply --dry-run

Terminal window
aerostack db neon create <name>

Creates a new Neon Postgres database and adds it to your aerostack.toml.

Terminal window
aerostack db neon create my-postgres-db
Terminal window
# Create a Postgres migration
aerostack db migrate new add_users_table --postgres
# Apply Postgres migrations
aerostack db migrate apply --postgres
aerostack db migrate apply --postgres --remote production

Terminal window
aerostack db pull

Alias for aerostack generate types. Introspects your database and generates TypeScript interfaces. See generate types for details.


Terminal window
# 1. Create a new migration
aerostack db migrate new add_products_table
# 2. Edit the SQL
# vim migrations/0001_add_products_table.sql
# 3. Apply locally and test
aerostack db migrate apply
# 4. Generate TypeScript types
aerostack generate types
# 5. When ready, apply to staging
aerostack db migrate apply --remote staging