aerostack db
Manage D1 and Neon Postgres databases — create databases, run migrations, and pull schemas.
Migrations (D1)
Section titled “Migrations (D1)”Create a migration
Section titled “Create a migration”aerostack db migrate new <name>Creates a timestamped SQL migration file in your migrations/ directory.
aerostack db migrate new add_users_tableApply migrations
Section titled “Apply migrations”# Apply locally (default)aerostack db migrate apply
# Apply to remote stagingaerostack db migrate apply --remote staging
# Apply to remote productionaerostack db migrate apply --remote productionCheck pending migrations
Section titled “Check pending migrations”aerostack db migrate apply --dry-runNeon Postgres
Section titled “Neon Postgres”Create a Neon database
Section titled “Create a Neon database”aerostack db neon create <name>Creates a new Neon Postgres database and adds it to your aerostack.toml.
aerostack db neon create my-postgres-dbPostgres migrations
Section titled “Postgres migrations”# Create a Postgres migrationaerostack db migrate new add_users_table --postgres
# Apply Postgres migrationsaerostack db migrate apply --postgresaerostack db migrate apply --postgres --remote productionPull schema & generate types
Section titled “Pull schema & generate types”aerostack db pullAlias for aerostack generate types. Introspects your database and generates TypeScript interfaces. See generate types for details.
Typical database workflow
Section titled “Typical database workflow”# 1. Create a new migrationaerostack db migrate new add_products_table
# 2. Edit the SQL# vim migrations/0001_add_products_table.sql
# 3. Apply locally and testaerostack db migrate apply
# 4. Generate TypeScript typesaerostack generate types
# 5. When ready, apply to stagingaerostack db migrate apply --remote staging