Blog Archives - 1 Record(s)

Remove Filter Year: '2025' - Month: '7'

CFMigrations Using Custom Manager with ContentBox modules

Edit the .cfmigrations.json file to include a new Manager with migrationDirectory and seedsDirectory in relative location.

"newManager": {
        "manager": "cfmigrations.models.QBMigrationManager",
        "migrationsDirectory": "modules_app/contentbox-custom/_modules/moduleName/resources/database/migrations/",
        "seedsDirectory": "modules_app/contentbox-custom/_modules/moduleName/resources/database/seeds/",
        "properties": {
            "defaultGrammar": "AutoDiscover@qb",
            "schema": "${Setting: DB_SCHEMA not found}",
            "migrationsTable": "cfmigrations_app",
            "connectionInfo": {
                "connectionString": "${Setting: DB_CONNECTIONSTRING not found}",
                "class": "${Setting: DB_CLASS not found}",
                "username": "${Setting: DB_USER not found}",
                "password": "${Setting: DB_PASSWORD not found}",
                "database": "${Setting: DB_DATABASE not found}",
                "bundleName": "${Setting: DB_BUNDLENAME not found}",
                "bundleVersion": "${Setting: DB_BUNDLEVERSION not found}"
            }
        }
    }

Create a new migration: box migrate create manager=newManager name=test

A new migration was created in the modules_app/contentbox-custom/_modules/moduleName/resources/database/migrations/ folder, update the SQL there that you need to run.

Run the new migration box migrate up manager=newManger

NOTE: You will need to have a .env file configured to run migrations already.

For more information on commandbox-migrations check the documentation