new
Scaffold a complete dbsh project structure. Aliases: scaffold, init-project.
Database required: No
Usage
bash
dbsh newbash
dbsh new --name MyApp --provider postgresqlbash
dbsh new --name MyApp --provider sqlserver --output ./my-db-projectbash
dbsh new --name MyApp --jsonWhen called without flags, dbsh new enters interactive mode:
- Prompts for your project name (default:
MyApp) - Lets you select the database provider from a list
- Asks whether to use the current directory or a different one
- Detects existing projects and asks about overwriting files
Options
| Option | Short | Description |
|---|---|---|
--name | -n | Project name (default: MyApp) |
--output | -o | Output directory (default: current directory) |
--force | -f | Overwrite existing files |
Also accepts global options like --provider, --json, etc.
What it creates
Database/
Config/
migration.json # global config
environments/
local.json
development.json
staging.json
production.json
Migrations/
Schema/
.gitkeep
V001__Example_Users.sql # provider-specific example
Data/
.gitkeep
Patch/
.gitkeep
Rollback/
.gitkeep
U001__Example_Users.sql # example rollback
Templates/
schema_migration.sql
data_migration.sql
patch_migration.sql
rollback_migration.sql
repeatable_migration.sql
.github/workflows/
database-migration.yml # GitHub Actions CI pipeline
.gitignoreThe example migration (V001__Example_Users.sql) is generated with correct SQL for your chosen provider — proper column types, defaults, and index syntax.
Modular monoliths
When prompted, you can enter comma-separated module names. Each module gets its own subfolder under Database/Migrations/ with schema-based isolation (PostgreSQL/SQL Server) or table-prefix naming (MySQL/SQLite).
After scaffolding
- Set your connection string (env var or edit
migration.json) - Run
dbsh create --name YourMigration --type schemato add scripts - Write your SQL
- Run
dbsh migrate