Skip to content

Missing DB_SCHEMA key in generated .env causes migrate install to falsely report table as already installed #69

@edyionescu

Description

@edyionescu

What are the steps to reproduce this issue?

  1. Create a new ColdBox app with migrations support: coldbox create app myApp --migrations
  2. Configure your database connection in the generated .env file (set DB_HOST, DB_PORT, DB_DATABASE, DB_USER, DB_PASSWORD)
  3. Run migrate install from the CommandBox shell

What happens?

The command reports the migration table as already installed without actually creating it:

> migrate install
Created seeds directory
Migration table already installed.

Running migrate uninstall confirms the table was never created:

> migrate uninstall
Uninstalling cfmigrations will also run all your migrations down. Are you sure you want to continue? [y/n] : y

ERROR (6.3.2+00858)

Table 'coldbox.cfmigrations' doesn't exist

What were you expecting to happen?

migrate install should create the cfmigrations table in the database and report:

Migration table installed!

Any logs, error output, etc?

ERROR (6.3.2+00858)

Table 'coldbox.cfmigrations' doesn't exist

Note: If you also encounter Invalid Syntax Closing [}] not found during migrate install, the ${DB_PORT} value in the generated .cfmigrations.json needs to be quoted as "${DB_PORT}" so the JSON is valid. This is a related open issue: commandbox-modules/commandbox-migrations#48

Any other comments?

The fix is to add DB_SCHEMA=<schema_name> to the .env.example template.

After manually adding DB_SCHEMA=coldbox to .env, the install command works correctly:

> migrate install
Migration table installed!

What versions are you using?

Operating System: Windows 11 Pro 25H2
Package Version: 8.12.0+30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions