db add
nexler db add
nexler db add <name> -type <mongo|mysql|postgres|mssql> [flags…]
Adds a new named database connection to an existing app's .env — not to be confused with nexler init db (which provisions the core schema on an already-declared connection; this declares a new connection). If -type isn't a driver the app was originally scaffolded with, this retrofits the missing driver support first (helper package, import wiring, and — if the dialect family is new to the app — db/db.go's Connect/Close cases).
| Flag | Default | Description |
|---|---|---|
| -type | required | mongo, mysql, postgres, or mssql. |
| -dir | "." | Path to the app directory. |
| -host | "" | Blank leaves the DSN blank for you to fill in by hand. |
| -port | conventional port | Defaults to the type's conventional port when -host is set. |
| -dbname | "" | Database name. |
| -user | "" | Username (blank = no auth). |
| -password | "" | Password, plain text (blank = no auth). |
<name> must be a valid identifier and can't be "core" — that's reserved for the app's own default connection. The new connection is reachable as db.SQL("<name>")/db.Mongo("<name>"), but never promoted to core.nexler db add analytics -type postgres -host localhost -dbname analytics nexler db add reports -type mssql -dir ./myapp