Skip to content

Commit d670bbc

Browse files
authored
fix(cli): use migrateToLatest command name for wheels migrate latest (#2307)
Both Module.cfc and MigrationRunner.cfc were mapping the user-visible `latest` action to the framework HTTP command name `migrateTo`. The framework's `/wheels/cli` endpoint treats `migrateTo` as "migrate to a specific version" — and silently no-ops when no version parameter is provided. The correct command name is `migrateToLatest`, which the endpoint dispatches via `migrator.migrateToLatest()`. Without this fix, `wheels migrate latest` exits 0 with the message "Migration latest completed." in green, but no migration is actually applied. The first VM-test journal observed this as "Migrating from 0 down to ." (the framework rolling back to nothing); the second VM-test journal observed it as a 0-byte database file with no schema. Both green CLI output, both broken framework behavior. A `&version=` empty appendix in Module.cfc (with a misleading comment claiming "omitting it runs to latest") was the smoking gun — that comment described the author's intent, not the framework's actual behavior. Discovered via local fresh-install harness (tools/test-onboarding.sh) which simulates a brand-new user running `wheels new` + `wheels migrate latest` in an isolated LUCLI_HOME and verifies the resulting sqlite database actually contains the migrated tables. Reported as F2 / F5 in two consecutive VM-onboarding runs.
1 parent 6e77607 commit d670bbc

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

cli/lucli/Module.cfc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2760,17 +2760,13 @@ component extends="modules.BaseModule" {
27602760
try {
27612761
var command = "";
27622762
switch (action) {
2763-
case "latest": command = "migrateTo"; break;
2763+
case "latest": command = "migrateToLatest"; break;
27642764
case "up": command = "migrateUp"; break;
27652765
case "down": command = "migrateDown"; break;
27662766
case "info": command = "info"; break;
27672767
}
27682768

27692769
var migrateUrl = "http://localhost:#serverPort#/wheels/cli?command=#command#&format=json";
2770-
if (action == "latest") {
2771-
// migrateTo needs a version — omitting it runs to latest
2772-
migrateUrl &= "&version=";
2773-
}
27742770

27752771
var httpResult = makeHttpRequest(migrateUrl);
27762772

cli/lucli/services/MigrationRunner.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ component {
8989
public struct function runViaHttp(required numeric serverPort, required string action) {
9090
var command = "";
9191
switch (action) {
92-
case "latest": command = "migrateTo"; break;
92+
case "latest": command = "migrateToLatest"; break;
9393
case "up": command = "migrateUp"; break;
9494
case "down": command = "migrateDown"; break;
9595
case "info": command = "info"; break;

0 commit comments

Comments
 (0)