{"id":51897534,"url":"https://github.com/baikho/drupal-migrate_helper","last_synced_at":"2026-07-26T12:03:36.161Z","repository":{"id":363324541,"uuid":"1181254142","full_name":"baikho/drupal-migrate_helper","owner":"baikho","description":"Provides utilities for managing Drupal migrations","archived":false,"fork":false,"pushed_at":"2026-03-24T17:36:20.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"1.0.x","last_synced_at":"2026-07-23T08:24:43.984Z","etag":null,"topics":["drupal","drupal-10","drupal-11","drupal-developers","drupal-development","drupal-migrate","drupal-migration","drupal-mod","drupal-plugin"],"latest_commit_sha":null,"homepage":"https://www.drupal.org/project/migrate_helper","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/baikho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-13T23:13:15.000Z","updated_at":"2026-03-31T09:05:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/baikho/drupal-migrate_helper","commit_stats":null,"previous_names":["baikho/drupal-migrate_helper"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/baikho/drupal-migrate_helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baikho%2Fdrupal-migrate_helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baikho%2Fdrupal-migrate_helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baikho%2Fdrupal-migrate_helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baikho%2Fdrupal-migrate_helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baikho","download_url":"https://codeload.github.com/baikho/drupal-migrate_helper/tar.gz/refs/heads/1.0.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baikho%2Fdrupal-migrate_helper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35913015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-26T02:00:06.503Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drupal","drupal-10","drupal-11","drupal-developers","drupal-development","drupal-migrate","drupal-migration","drupal-mod","drupal-plugin"],"created_at":"2026-07-26T12:03:35.490Z","updated_at":"2026-07-26T12:03:36.147Z","avatar_url":"https://github.com/baikho.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Migrate Helper\n\nProvides utilities for managing Drupal migrations, including the ability to rename migration machine names and their associated database tables without data loss.\n\n## Features\n\n1. **Source lookup**: View migration source information for entities via admin tab\n2. **Quick status**: Check migration status without HTTP or row count overhead\n3. **Migration info**: Inspect migration tables and configuration\n4. **List tables**: View all migration tables and identify orphaned ones\n5. **Cleanup stubs**: Remove orphaned stub entities left over after migrations complete\n6. **Rename migrations**: Rename one migration by ID, or many at once by prefix (bulk), without losing map/message data\n\n## Installation\n\n```bash\ndrush en migrate_helper\n```\n\n## Reference\n\n\n### 1. Source lookup\n\nA \"Migrate Source\" tab is added to entity pages, allowing administrators to view migration information for migrated content.\n\n**Supported entity types:**\n\n- Nodes (`/node/{nid}/migrate-source`)\n- Media (`/media/{mid}/migrate-source`)\n- Taxonomy terms (`/taxonomy/term/{tid}/migrate-source`)\n\n**Information displayed:**\n\n- Source IDs from the original migration\n- Destination IDs (the Drupal entity ID)\n- Migration status (Imported, Needs update, Stub, Failed)\n- Last import timestamp\n- Which migration(s) created the entity\n\nThe module dynamically discovers which migrations target each entity type, so it works with any migration configuration.\n\n**Permission required**: `administer migrations`\n\n### 2. Quick status\n\nCheck the status of all migrations without the overhead of HTTP requests or row counting (unlike `drush migrate:status`):\n\n```bash\n# Status for all migrations\ndrush migrate-helper:status-all\n\n# Filter by migration group\ndrush migrate-helper:status-all --group=my_group\n```\n\nShows the internal migration status (Idle, Importing, Rolling back, Stopping, Disabled) for each migration.\n\nAliases: `mh-status`, `migrate-status-all`\n\n### 3. Migration info\n\nDisplay information about a migration's tables and configuration:\n\n```bash\ndrush migrate-helper:info my_migration\n```\n\nOutput shows:\n\n- Associated database tables (`migrate_map_*`, `migrate_message_*`)\n- Row counts for each table\n- Whether a migration config entity exists\n- Whether key-value state exists\n\nAliases: `mh-info`, `migrate-info`\n\n### 4. List tables\n\nList all migration tables in the database:\n\n```bash\n# List all tables\ndrush migrate-helper:list-tables\n\n# List only orphaned tables (tables without corresponding config)\ndrush migrate-helper:list-tables --orphaned\n```\n\nAliases: `mh-tables`, `migrate-tables`\n\n### 5. Cleanup stubs\n\nRemove orphaned stub entities left over after migrations complete. Stubs are placeholder entities created when a migration references content that hasn't been migrated yet. After all migrations complete, remaining stubs indicate broken references.\n\n```bash\n# Preview what would be deleted\ndrush migrate-helper:cleanup-stubs --dry-run\n\n# Delete all unresolved stub entities\ndrush migrate-helper:cleanup-stubs\n```\n\nFor each stub found, this command:\n\n- Deletes the placeholder entity from Drupal\n- Removes the row from the `migrate_map_*` table\n- Removes related entries from the `migrate_message_*` table\n\nAliases: `mh-stubs`, `migrate-cleanup-stubs`\n\n### 6. Rename migrations\n\nModern Drupal migrations are typically defined in YAML files (in `migrations/` or `config/install/`). The migration **definition** (ID, source, process, destination) lives in code/YAML, but the **data** (source-to-destination mappings, messages, status) lives in the database:\n\n- `migrate_map_{id}` - Maps source IDs to destination entity IDs\n- `migrate_message_{id}` - Stores migration warnings/errors\n- `key_value` entries - Stores last import times and status\n\n**Typical workflow when renaming a migration:**\n\n1. Update your YAML file with the new migration ID (e.g., rename `old_migration.yml` to `new_migration.yml` and change `id: new_migration`)\n2. Deploy the code change\n3. Run `drush migrate-helper:rename old_migration new_migration`\n4. The database tables and state are renamed to match the new ID\n5. The migration continues where it left off with all mappings preserved\n\nThis is safe because the migration plugin is discovered from YAML, and this tool just ensures the database tables match the new ID.\n\n**Single migration:** rename one ID and its tables.\n\n```bash\n# Preview the rename operation\ndrush migrate-helper:rename old_migration_id new_migration_id --dry-run\n\n# Execute the rename\ndrush migrate-helper:rename old_migration_id new_migration_id\n```\n\nAliases: `mh-rename`, `migrate-rename`\n\n**Bulk rename:** rename every migration whose ID starts with a prefix (string replace on the prefix).\n\n```bash\n# Preview bulk rename\ndrush migrate-helper:bulk-rename old_prefix new_prefix --dry-run\n\n# Execute bulk rename\ndrush migrate-helper:bulk-rename old_prefix new_prefix\n```\n\nAliases: `mh-bulk`, `migrate-bulk-rename`\n\n#### What gets renamed\n\nWhen you rename a migration (single or bulk), this module handles:\n\n1. **Database tables**: `migrate_map_{id}` and `migrate_message_{id}` are renamed\n2. **Key-value state**: Entries in `migrate_last_imported` and `migrate_status` collections are migrated\n3. **Config entities** (optional): If a `migrate_plus.migration.{id}` config entity exists in active config, it's cloned with the new ID\n\nAll source-to-destination mappings and messages are preserved, so rollbacks and incremental imports continue to work correctly.\n\n#### Service API\n\nYou can use the service programmatically, which is useful for update hooks:\n\n```php\n/** @var \\Drupal\\migrate_helper\\Service\\MigrateRenameService $service */\n$service = \\Drupal::service('migrate_helper.migrate_rename');\n\n// Get migration info\n$info = $service-\u003egetMigrationInfo('my_migration');\n\n// Rename a migration\n$result = $service-\u003erenameMigration('old_id', 'new_id');\n\n// Dry run (returns what would be changed)\n$result = $service-\u003erenameMigration('old_id', 'new_id', dryRun: TRUE);\n\n// List all migration tables\n$tables = $service-\u003elistMigrationTables();\n```\n\n\n\n\n\n\n#### PostgreSQL Table Name Limit\n\nPostgreSQL truncates identifiers to 63 characters. Since migration tables use prefixes like `migrate_message_` (16 chars), the maximum recommended migration ID length is **47 characters**.\n\nIf you try to rename to a longer ID, you'll see a warning:\n\n```\nWARNING: Migration ID 'very_long_migration_name_that_exceeds_the_limit' (47+ chars)\nmay cause issues on PostgreSQL. See https://www.drupal.org/project/drupal/issues/2845340\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaikho%2Fdrupal-migrate_helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaikho%2Fdrupal-migrate_helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaikho%2Fdrupal-migrate_helper/lists"}