Skip to content

--dry-run executes against the database instead of previewing #49

Description

@damusix

Summary

noorm --dry-run run build applies every file to the target database. The CLI documents --dry-run as previewing without executing.

Repro

  1. Create an empty database.
  2. Point a config at it (env-only mode is fine):
    export NOORM_CONNECTION_DIALECT=mssql
    export NOORM_CONNECTION_HOST=localhost
    export NOORM_CONNECTION_PORT=1433
    export NOORM_CONNECTION_DATABASE=scratch
    export NOORM_CONNECTION_USER=SA
    export NOORM_CONNECTION_PASSWORD='<pw>'
    
  3. noorm --dry-run run build
  4. Query the database: SELECT COUNT(*) FROM sys.objects WHERE is_ms_shipped = 0;

Expected

Nothing applied. A list of what would run.

Actual

The build ran for real. In our case 307 objects were created in a database that was empty beforehand — a full schema build, from a flag whose documented purpose is to avoid exactly that.

The documented contract, from the CLI reference:

--dry-run    Preview what would happen without executing.

This is the worst-case shape for a flag bug: the person reaching for --dry-run is by definition the one who is not ready to write.

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, mcr.microsoft.com/mssql/server:2022-latest

Context

Found while migrating a production MSSQL schema (~155 files, 9 phase directories) from a hand-rolled zsh deploy script to noorm. Four related CLI issues were found in the same effort and are filed separately.

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