Skip to content

feat: improve redis migration flow#618

Merged
alexluong merged 5 commits into
mainfrom
migrations
Jan 14, 2026
Merged

feat: improve redis migration flow#618
alexluong merged 5 commits into
mainfrom
migrations

Conversation

@alexluong

Copy link
Copy Markdown
Collaborator
  • add tests
  • support --all flag to apply all pending migrations
  • support IsApplicable mechanism

@vercel

vercel Bot commented Jan 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
outpost-docs Ready Ready Preview, Comment Jan 13, 2026 1:28pm
outpost-website Ready Ready Preview, Comment Jan 13, 2026 1:28pm

Base automatically changed from list-tenant to main January 14, 2026 12:56
Add baseline tests for Redis migration runner with mock migrations.

Tests cover:
- GetPendingMigrations: pending list accuracy and metadata
- Fresh installation: skip execution on empty Redis
- Existing installation: auto-runnable execution, version ordering,
  failure handling, skip already applied
- Data detection: outpost:* and tenant:* key patterns
Tests for the CLI Migrator (cmd/outpost-migrate-redis):
- Apply next pending migration
- Apply specific migration by name
- Confirmation prompts (autoApprove, rejection)
- Error handling (plan failure, apply failure)
- Migration marked as applied after success
- Plan command
- Verify command
Adds batch migration support to the CLI:
- `apply --all` runs all pending migrations in sequence
- Each migration is verified after application before proceeding
- Stops immediately on any failure (apply or verification)
- Shows progress [1/N], [2/N], etc.

Also refactors Apply/ApplyOne:
- Apply(ctx, autoApprove) - batch mode for all pending
- ApplyOne(ctx, autoApprove, rerun, name) - single migration

Includes tests for the new batch functionality:
- applies all pending migrations in order
- stops on migration failure
- stops on verification failure
- marks all migrations as applied
Adds applicability checks so migrations can declare themselves as
"not needed" based on configuration:

- Add IsApplicable(ctx) (bool, string) to Migration interface
- 001_hash_tags returns false when DEPLOYMENT_ID is set
  (hash tags already in place)
- 002_timestamps and 003_entity always return true

Migration status handling:
- New status: "not_applicable" alongside "applied"
- isSatisfied() checks both statuses for startup/CLI checks
- Non-applicable migrations don't block init --current

Includes tests for:
- Runner marks non-applicable as not_applicable
- CLI Apply skips and marks non-applicable migrations
- Subsequent runs skip already-marked migrations
@alexluong alexluong merged commit c72e538 into main Jan 14, 2026
1 check passed
@alexluong alexluong deleted the migrations branch January 14, 2026 18:55
@vercel vercel Bot temporarily deployed to Preview – outpost-website January 14, 2026 18:56 Inactive
@vercel vercel Bot temporarily deployed to Preview – outpost-docs January 14, 2026 18:56 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants