Skip to content

migrate up --pretend executes DDL when migration uses queryExecute() directly #50

@edyionescu

Description

@edyionescu

migrate up --pretend is supposed to print the SQL that would run without executing it. When a migration uses queryExecute() directly, the DDL is silently committed to the database (only the write to the cfmigrations table is skipped).

Migrations using the schema/qb builder are not affected.

Steps to reproduce

  1. Create a migration that uses queryExecute() in up()
  2. Run migrate up --pretend
  3. No SQL is printed, but the table is created in the database
  4. Run again - fails with Table 'X' already exists
// Affected - DDL executes despite --pretend
function up( schema, qb ){
    queryExecute("CREATE TABLE users ( ... )");
}

// Not affected - schema builder correctly handles pretend mode
function up( schema, qb ){
    schema.create("users", function(table){
        table.increments("id");
    });
}

Environment

  • commandbox-migrations: 5.3.0
  • db: MySQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions