fix(lagoon): keep Status plugin-only; migrate:status adds the framework sets itself (WR-12)

57a849d made lagoon.Status read migrationSets, which changed its result
for consumers: the framework sets came first and a plugin with no
migrations lost its row. Status is back to its pre-57a849d behaviour.
migrate:status (table and --json) now reads the unexported setStatus,
which lists the framework sets and the plugins from migrationSets, so it
still agrees with migrate --pretend. Both share historyRows.

- TestStatusPluginRows pins Status: plugin rows only, an empty row for a
  plugin with no migrations or no history table, none without HasMigrations
- TestMigrateStatusJSON also checks the table lists the framework sets
- TestTwoPluginMigrationSetsIsolated and TestDocsMigrate are back to the
  plugin-only rows
This commit is contained in:
Jakub Zych
2026-10-22 04:30:36 +02:00
parent f5e9ee508b
commit 139f5e3942
8 changed files with 116 additions and 67 deletions

View File

@@ -359,16 +359,9 @@ func TestDocsMigrate(t *testing.T) {
if err != nil {
t.Fatal(err)
}
// The framework's own sets come first (WR-12), then the plugin.
framework := []string{"summercms.attach", "summercms.cabana", lagoon.DeferredHistoryID, lagoon.QueueHistoryID}
want := "acme.blog summer_migrations_acme_blog [20260101000100_create_posts 20260101000200_create_comments_and_categories]"
if len(lines) != len(framework)+1 || lines[len(lines)-1] != want {
t.Fatalf("status = %q, want the framework sets and then %q", lines, want)
}
for i, id := range framework {
if !strings.HasPrefix(lines[i], id+" ") {
t.Errorf("status line %d = %q, want the framework set %s", i, lines[i], id)
}
if len(lines) != 1 || lines[0] != want {
t.Fatalf("status = %q, want %q", lines, want)
}
if db.Migrator().HasTable("acme_blog_comments") {
t.Fatal("rollback left acme_blog_comments")