Skip to content

db create ignores NOORM_CONNECTION_* and targets the active config #51

Description

@damusix

Summary

noorm db create ignores env-only connection configuration and uses the active persisted config instead, creating a database the caller did not ask for. noorm run build honours the same variables correctly.

Repro

  1. Have a persisted config active — say cp9_scratch, pointing at database noorm_cp9.
  2. Set env-only connection vars targeting a different database:
    export NOORM_CONNECTION_DIALECT=mssql
    export NOORM_CONNECTION_HOST=localhost
    export NOORM_CONNECTION_PORT=1433
    export NOORM_CONNECTION_DATABASE=owl_scratch10
    export NOORM_CONNECTION_USER=SA
    export NOORM_CONNECTION_PASSWORD='<pw>'
    
  3. noorm db create
  4. SELECT name FROM sys.databases;

Expected

owl_scratch10 created — env-only mode is the documented approach for CI/CD, where there is no persisted config to fall back to.

Actual

noorm_cp9 created. owl_scratch10 does not exist. No warning that the env vars were disregarded.

noorm run build under the identical environment targets owl_scratch10 correctly — verified by pointing it at a non-existent database name and getting the expected "does not exist" error. So the two commands disagree about where the connection comes from.

Impact

In CI this creates a database named by whatever config happens to be checked in, not by the pipeline's environment. Locally it silently resurrects scratch databases you thought you had finished with.

Environment

  • noorm CLI 0.0.0, core 1.0.0-alpha.39
  • OS: macOS (darwin 25.5.0)
  • Runtime: Node v24.13.0
  • Dialect: mssql

Context

Found while wiring a developer tool's db verb to build a schema through noorm. The workaround was to create the database with sqlcmd and let noorm run build populate it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions