Skip to content

feature: implement DevMigrator closes #283#394

Merged
g105b merged 12 commits into
masterfrom
283-dev-migration
Jun 10, 2026
Merged

feature: implement DevMigrator closes #283#394
g105b merged 12 commits into
masterfrom
283-dev-migration

Conversation

@g105b

@g105b g105b commented Apr 2, 2026

Copy link
Copy Markdown
Member

New features:

  • gt migrate --dev runs normal migrations, then applies query/_migration/dev files tracked separately in the _migration_dev table.
  • gt migrate --dev-merge runs normal migrations, then renumbers and moves applied dev migrations into the canonical migration directory and records them as already applied in _migration.

Key changes are in the new DevMigrator, Migrator and ExecuteCommand. I've split out the Migrator class into an abstract base class so both Migrator and DevMigrator can share the functionality.

@g105b g105b linked an issue Apr 2, 2026 that may be closed by this pull request
@codacy-production

codacy-production Bot commented Apr 2, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 117 complexity · 0 duplication

Metric Results
Complexity 117
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@g105b

g105b commented Apr 9, 2026

Copy link
Copy Markdown
Member Author

This latest change adds per-statement progress tracking, to allow for partial migration success.

@pixeldrift64 and I are working together on a busy production app, and the database struggled to add a new column in amongst heavy user traffic, but half of the migration did succeed. This change accommodates for this, so a partial success will be recorded, and the next migration will resume from where the current migration succeeded.

Integrity checks are still applied for the whole files, so if a partially applied migration is edited before it resumes, it will correctly fail with a migration integrity error instead of continuing with changed SQL.

Both _migration and _migration_dev tables are upgraded automatically to add the new progress column when migrations run, so existing production installations can adopt the featire without a manual schema change.

Feedback is welcome while I give this more thought.

g105b added 3 commits June 10, 2026 11:05
# Conflicts:
#	src/Cli/ExecuteCommand.php
#	src/Migration/Migrator.php
#	test/phpunit/Cli/ExecuteCommandTest.php
@g105b g105b merged commit 82e14aa into master Jun 10, 2026
41 checks passed
@g105b g105b deleted the 283-dev-migration branch June 10, 2026 10:27
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.

How to handle local development (pre-migration)?

1 participant