apply
Compute the plan and apply it to the target database. Prompts for confirmation before making changes unless --auto-approve is given.
nschema applynschema apply --plan-file tonight.nplan # apply exactly what plan --out savedOptions
Section titled “Options”apply accepts every plan option, plus:
-y,--auto-approve— skip the confirmation prompt and apply immediately. Required for non-interactive runs (CI, ECS tasks).-p,--plan-file <path>— replay a plan saved byplan --out, executing exactly that plan instead of computing a fresh one (Terraform’sapply <planfile>). The saved plan already fixes its scope, desired schema, and policy flags, so those inputs are ignored. A live database to write to is still required, and you’re still prompted for confirmation unless--auto-approveis given.--no-lock— skip taking the state-store lock for this run. Use it only when you’ve coordinated access by other means (for example you already hold the lock vianschema lock acquire).
After a successful apply
Section titled “After a successful apply”If a state store is configured, the resulting schema is captured to it after a successful apply, so later offline plans can run against that snapshot.
Deployment scripts (inline SCRIPT … ON PRE|POST DEPLOYMENT statements) run before and after the migration respectively.