Skip to content

Conversation

@AlexSkrypnyk
Copy link
Member

@AlexSkrypnyk AlexSkrypnyk commented Feb 10, 2026

Closes #1642

Summary by CodeRabbit

  • New Features

    • Optional second migration database (local service + env/config wiring), new CLI commands to open/download it, and a --fresh/force download option; migration provisioning with skip/rollback controls and verification.
  • Documentation

    • New migration guide covering setup, env variables, installer prompts, workflows, and example migration.
  • Tests

    • Added unit and functional tests and CI steps to cover migration flows, DB download, provisioning, and installer prompts.
  • Chores

    • CI/workflow/cache key updates and environment variable exposures for the migration DB.

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds optional second (migration) database: install prompts/handlers, env and Docker wiring for database2, Ahoy/CI/Lagoon download and open commands, download-script prefixing to reuse download logic, a migration provision script and module, docs, and extensive tests.

Changes

Cohort / File(s) Summary
Installer prompts & wiring
\.vortex/installer/src/Prompts/Handlers/Migration.php, \.vortex/installer/src/Prompts/Handlers/MigrationDownloadSource.php, \.vortex/installer/src/Prompts/PromptManager.php
Add Migration and MigrationDownloadSource handlers, integrate into prompt flow, update TOTAL_RESPONSES and processing order.
Environment & compose
\.env, docker-compose.yml, .vortex/tests/phpunit/Fixtures/docker-compose*.json, web/sites/default/settings.migration.php, web/sites/default/settings.php
Add VORTEX_DOWNLOAD_DB2_* and DATABASE2_* vars, add database2 service, expose DATABASE2_* to services, and conditional loading of migration settings.
Ahoy / CI / Lagoon
.ahoy.yml, .circleci/config.yml, .github/workflows/build-test-deploy.yml, .lagoon.yml
Add db2 and download-db2 Ahoy commands; CI and Lagoon steps to download/copy migration DB2; bump cache key tags and surface DB2 handling.
Download scripts (prefixing)
scripts/vortex/download-db.sh, scripts/vortex/download-db-*.sh (acquia, container-registry, ftp, lagoon, s3, url)
Introduce _vortex_var_prefix_default/VORTEX_VAR_PREFIX shim and propagate prefixed env vars so existing download scripts work for DB2; adjust nested default fallbacks.
Provisioning & migration orchestration
scripts/custom/provision-20-migration.sh
New provisioning script to import/verify migration DB, enable ys_migrate, run/rollback migrations, probe source DB and handle verification and flags (skip/rollback/update/import).
Drupal migration module & config
web/modules/custom/ys_migrate/ys_migrate.info.yml, web/modules/custom/ys_migrate/migrations/ys_migrate_categories.yml, composer.json
Add ys_migrate module and migration YAML; add drupal/migrate_plus and drupal/migrate_tools composer dependencies.
Docs & utilities
.vortex/docs/content/drupal/migrations.mdx, .vortex/docs/.utils/create-migrate-source-db.sh
Add migration documentation page and a utility script producing a sample migration SQL dump.
Tests & fixtures
.vortex/tests/bats/*, .vortex/tests/phpunit/Functional/AhoyWorkflowTest.php, .vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php, .vortex/installer/tests/**/*, tests/phpunit/Drupal/*, .vortex/tests/phpunit/Fixtures/*
Add many unit/functional tests for handlers, provisioning, download flows; extend docker-compose fixtures with DATABASE2_* and database2 service; add BATS and PHPUnit cases for migration scenarios.
Misc
.gitignore, .ahoy.yml, .vortex/docs/*
Unignore settings.migration.php; add MIGRATION token blocks and Ahoy db2/download-db2 command entries; doc/utility additions.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant User
    participant Installer
    participant PromptManager
    participant CLI as Ahoy/CLI
    participant Docker
    participant DownloadScript
    participant Drush
    participant DB2 as database2

    User->>Installer: run installer
    Installer->>PromptManager: ask Migration & Source
    PromptManager-->>Installer: write .env / tokens

    User->>CLI: ahoy build / up
    CLI->>Docker: start services
    Docker->>DB2: start & become ready

    User->>CLI: ahoy download-db2
    CLI->>DownloadScript: run download-db.sh (VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2)
    DownloadScript-->>CLI: place .data/db2.sql

    User->>CLI: ahoy provision
    CLI->>Drush: run provision-20-migration.sh
    Drush->>DB2: import/verify dump, run migrations
    Drush-->>CLI: report status
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

PR: Needs review

Poem

🐰 A hop, a script, a second store,
I dug a tunnel to fetch some more.
Prompts, Docker, downloads in tune,
Migrations dance beneath the moon,
Hooray — two burrows, one bright spring!

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 59.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: adding support for a migration database. It directly relates to the extensive changeset.
Linked Issues check ✅ Passed All primary coding requirements from issue #1642 are met: migration database configuration with environment variables, fallbacks, settings file creation, and integration across infrastructure.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing migration database support. No unrelated modifications were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/1642-add-migration-db

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 12

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.vortex/installer/src/Prompts/PromptManager.php (1)

7-18: ⚠️ Potential issue | 🟠 Major

Fix use-statement ordering (CI failure).

The pipeline reports Slevomat ordering violations; move the new Migration* imports into alphabetical position.

✅ Suggested fix
-use DrevOps\VortexInstaller\Prompts\Handlers\DeployTypes;
-use DrevOps\VortexInstaller\Prompts\Handlers\Migration;
-use DrevOps\VortexInstaller\Prompts\Handlers\MigrationDownloadSource;
-use DrevOps\VortexInstaller\Prompts\Handlers\Domain;
-use DrevOps\VortexInstaller\Prompts\Handlers\Dotenv;
+use DrevOps\VortexInstaller\Prompts\Handlers\DeployTypes;
+use DrevOps\VortexInstaller\Prompts\Handlers\Domain;
+use DrevOps\VortexInstaller\Prompts\Handlers\Dotenv;
+use DrevOps\VortexInstaller\Prompts\Handlers\Migration;
+use DrevOps\VortexInstaller\Prompts\Handlers\MigrationDownloadSource;
🤖 Fix all issues with AI agents
In @.ahoy.yml:
- Around line 142-149: The download-db command uses the wrong env var name
(VORTEX_DOWNLOAD_DB_FRESH) so the --fresh flag is ignored; change the variable
exported in the download-db command to VORTEX_DOWNLOAD_DB_FORCE to match the
check in download-db.sh (and align with download-db2), ensuring the script sees
the force flag when run.

In @.circleci/config.yml:
- Around line 366-370: The shell variable expansion
${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql} is unquoted in the if test and docker
compose cp command which can cause word-splitting; update both occurrences (the
if [ -f ... ] test and the docker compose cp -L ... command) to use the quoted
form "${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql}" so the filename is treated as a
single token and matches the quoting style used elsewhere in CI.

In @.env:
- Around line 243-247: The env file defines duplicate keys named
VORTEX_DOWNLOAD_DB2_URL (in both the MIGRATION and DEMO sections) which triggers
dotenv-linter warnings; pick a single canonical key or rename the demo-specific
one (e.g., VORTEX_DOWNLOAD_DB2_URL_DEMO), or comment/gate the unused entry so
only one active VORTEX_DOWNLOAD_DB2_URL remains; update any code or docs that
reference VORTEX_DOWNLOAD_DB2_URL to use the new demo-specific name if you
rename it.

In @.github/workflows/build-test-deploy.yml:
- Around line 348-352: The two shell lines that test and copy the DB file use
unquoted parameter expansion `${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql}` which risks
word-splitting (ShellCheck SC2086); update both occurrences in the if-test and
the docker compose cp invocation to use quoted expansions (e.g., wrap the
parameter expansion in double quotes) so the test [ -f ... ] and docker compose
cp -L target path handle filenames with spaces correctly; ensure you quote both
the source and destination expansions consistently in the if condition and the
docker compose cp call.

In @.lagoon.yml:
- Around line 64-72: The migration download step runs unconditionally and lacks
the pre-download cleanup; either (A) restrict it to non-production like the
primary DB download by adding the same environment guard used there and run rm
-Rf $VORTEX_DB_DIR || true before invoking VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2
./scripts/vortex/download-db.sh (preserving the
VORTEX_DOWNLOAD_DB_SSH_FILE/VORTEX_DB_DIR vars), or (B) if it is intended to run
in all environments, add an explicit comment above this run block stating that
running migrations/downloads in production is intentional and explain why;
update the block around VORTEX_DOWNLOAD_DB_SSH_FILE, VORTEX_DB_DIR and the
download script accordingly.

In @.vortex/docs/.utils/create-migrate-source-db.sh:
- Around line 8-12: The usage comment is misleading: it mentions DB_URL and
implies the script executes against a DB, but the script only emits SQL for
piping/import; update the header of create-migrate-source-db.sh to accurately
describe behavior (e.g., "prints SQL to stdout for piping/import; to execute,
pipe into mysql using DB_URL or use --sql with drush"), or implement DB_URL
handling by adding execution logic that reads DB_URL and runs the generated SQL
against that connection; reference the script name create-migrate-source-db.sh
and the DB_URL and --sql usages when making the change.

In @.vortex/installer/src/Prompts/Handlers/MigrationDownloadSource.php:
- Around line 93-115: Add a guard at the start of process() to return early when
the handler should not run: call $this->shouldRun() and if it returns false skip
the rest so you never call getResponseAsString() when Migration is disabled;
keep the rest of the logic (writing VORTEX_DOWNLOAD_DB2_SOURCE via
Env::writeValueDotenv using $this->tmpDir, iterating MigrationDownloadSource
constants and calling File::removeTokenAsync) unchanged but only execute it
after the shouldRun check.

In `@composer.json`:
- Around line 18-19: The composer.json references an invalid release for
drupal/migrate_tools (^6.0.8); update the version constraint for
"drupal/migrate_tools" to "^6.0.5" (or to a known valid constraint) and
optionally bump "drupal/migrate_plus" to "^6.0.10" if you want explicit Drupal
11 support; after changing the "drupal/migrate_tools" and/or
"drupal/migrate_plus" entries run composer update drupal/migrate_tools
drupal/migrate_plus to verify the resolved versions and run your test/site build
to ensure compatibility.

In `@docker-compose.yml`:
- Around line 201-207: The database2 service currently hardcodes
MYSQL_DATABASE/MYSQL_USER/MYSQL_PASSWORD to "drupal", which conflicts with the
external override variables; update the environment values in the database2
service so they read from the corresponding override variables (use
DATABASE2_NAME, DATABASE2_USERNAME, DATABASE2_PASSWORD with sensible defaults)
instead of the fixed "drupal" strings; edit the database2 block and replace the
MYSQL_DATABASE, MYSQL_USER and MYSQL_PASSWORD entries to reference those
override variables so container bootstrapping matches runtime overrides.

In `@scripts/custom/provision-20-migration.sh`:
- Around line 111-137: The script interpolates MIGRATION_SOURCE_DB_PROBE_TABLE
directly into SQL which allows injection; add a strict validation step before
the first probe (and reuse it before the final verification) that ensures
MIGRATION_SOURCE_DB_PROBE_TABLE matches an allowlist or a tight regex (e.g.,
only [a-zA-Z0-9_]+ or compare against an explicit list of known table names) and
abort with a clear fail message if validation fails; update the checks around
the drush sql:query calls (the probe and the final verification) to rely on the
validated value so no untrusted input is ever concatenated into the SQL.
- Around line 125-129: The current import uses indirect command substitution
with drush sql:connect, which triggers ShellCheck SC2091; replace that use with
the supported drush sql:cli invocation to run the SQL file into the migrate
database. Specifically, keep the drush sql:drop --database=migrate call, remove
the $(drush sql:connect --database=migrate) <... pattern, and invoke drush
sql:cli --database=migrate with the SQL file redirected into its stdin (using
the same ${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE} variable) so the import
uses drush's CLI entrypoint instead of command substitution.

In `@web/modules/custom/ys_migrate/src/Plugin/migrate/source/Categories.php`:
- Around line 54-56: The prepareRow() method in the Categories source plugin is
an unnecessary override because it only calls parent::prepareRow($row);; remove
the redundant prepareRow() method from the Categories class to let the inherited
implementation be used and reduce noise (ensure no other code in this class
depends on this method existing before deleting it).

Comment on lines +142 to +149
#;< MIGRATION
download-db2:
usage: Download second database (migration). Run with "--fresh" to force.
aliases: [fetch-db2]
cmd: |
case " $* " in *" --fresh "*) export VORTEX_DOWNLOAD_DB_FORCE=1;; esac
VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
#;> MIGRATION
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check what variables download-db.sh actually uses
rg -n "VORTEX_DOWNLOAD_DB_FORCE|VORTEX_DOWNLOAD_DB_FRESH" scripts/vortex/download-db.sh

Repository: drevops/vortex

Length of output: 278


🏁 Script executed:

# Check the download-db command to verify the variable it uses
sed -n '135,145p' .ahoy.yml

Repository: drevops/vortex

Length of output: 446


🏁 Script executed:

# Get more context around both commands
sed -n '130,155p' .ahoy.yml

Repository: drevops/vortex

Length of output: 998


Fix variable name mismatch in download-db command — the --fresh flag is broken.

The download-db command sets VORTEX_DOWNLOAD_DB_FRESH=1, but download-db.sh checks for VORTEX_DOWNLOAD_DB_FORCE (line 58). This means the --fresh flag has no effect. The download-db2 command correctly uses VORTEX_DOWNLOAD_DB_FORCE, so align download-db to use the same variable for consistency.

🤖 Prompt for AI Agents
In @.ahoy.yml around lines 142 - 149, The download-db command uses the wrong env
var name (VORTEX_DOWNLOAD_DB_FRESH) so the --fresh flag is ignored; change the
variable exported in the download-db command to VORTEX_DOWNLOAD_DB_FORCE to
match the check in download-db.sh (and align with download-db2), ensuring the
script sees the force flag when run.

Comment on lines +243 to +247
#;< MIGRATION_DB_DOWNLOAD_SOURCE_URL
# Second database dump file sourced from a URL.
#
# HTTP Basic Authentication credentials should be embedded into the value.
VORTEX_DOWNLOAD_DB2_URL=
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Avoid duplicate VORTEX_DOWNLOAD_DB2_URL keys.

The key appears in both the MIGRATION and DEMO blocks, which triggers the dotenv-linter duplication warning and makes precedence unclear. Consider commenting out one, using a distinct demo-only key, or gating so only one active value remains.

Also applies to: 361-365

🤖 Prompt for AI Agents
In @.env around lines 243 - 247, The env file defines duplicate keys named
VORTEX_DOWNLOAD_DB2_URL (in both the MIGRATION and DEMO sections) which triggers
dotenv-linter warnings; pick a single canonical key or rename the demo-specific
one (e.g., VORTEX_DOWNLOAD_DB2_URL_DEMO), or comment/gate the unused entry so
only one active VORTEX_DOWNLOAD_DB2_URL remains; update any code or docs that
reference VORTEX_DOWNLOAD_DB2_URL to use the new demo-specific name if you
rename it.

Comment on lines +64 to +72
#;< MIGRATION
- run:
name: Download migration database
command: |
export VORTEX_DOWNLOAD_DB_SSH_FILE=false
export VORTEX_DB_DIR=/tmp/data
VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
service: cli
#;> MIGRATION
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Verify intended behavior for migration database download.

Two potential concerns:

  1. No environment check: Unlike the primary DB download (lines 54-60) which skips production, the migration download runs unconditionally. If migrations should only run in non-production environments, add an environment check.

  2. Missing directory cleanup: The primary DB download runs rm -Rf $VORTEX_DB_DIR || true before downloading, but the migration download doesn't. Since both use /tmp/data, stale files could cause issues.

If migrations should run in all environments, consider adding a comment to clarify this is intentional.

Suggested fix (if non-production only)
     #;< MIGRATION
     - run:
         name: Download migration database
         command: |
+          if [ "$LAGOON_ENVIRONMENT_TYPE" != "production" ] && [ "$LAGOON_GIT_BRANCH" != "${VORTEX_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
           export VORTEX_DOWNLOAD_DB_SSH_FILE=false
           export VORTEX_DB_DIR=/tmp/data
           VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
+          fi
         service: cli
     #;> MIGRATION
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#;< MIGRATION
- run:
name: Download migration database
command: |
export VORTEX_DOWNLOAD_DB_SSH_FILE=false
export VORTEX_DB_DIR=/tmp/data
VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
service: cli
#;> MIGRATION
#;< MIGRATION
- run:
name: Download migration database
command: |
if [ "$LAGOON_ENVIRONMENT_TYPE" != "production" ] && [ "$LAGOON_GIT_BRANCH" != "${VORTEX_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
export VORTEX_DOWNLOAD_DB_SSH_FILE=false
export VORTEX_DB_DIR=/tmp/data
VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
fi
service: cli
#;> MIGRATION
🤖 Prompt for AI Agents
In @.lagoon.yml around lines 64 - 72, The migration download step runs
unconditionally and lacks the pre-download cleanup; either (A) restrict it to
non-production like the primary DB download by adding the same environment guard
used there and run rm -Rf $VORTEX_DB_DIR || true before invoking
VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
(preserving the VORTEX_DOWNLOAD_DB_SSH_FILE/VORTEX_DB_DIR vars), or (B) if it is
intended to run in all environments, add an explicit comment above this run
block stating that running migrations/downloads in production is intentional and
explain why; update the block around VORTEX_DOWNLOAD_DB_SSH_FILE, VORTEX_DB_DIR
and the download script accordingly.

Comment on lines +18 to +19
"drupal/migrate_plus": "^6.0.7",
"drupal/migrate_tools": "^6.0.8",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

drupal/migrate_plus 6.0.7 drupal 11 compatibility

💡 Result:

Yes—drupal/migrate_plus 6.0.7 is compatible with Drupal 11: its release page lists “Works with Drupal: >= 9.1”, which includes Drupal 11. [1]

That said, for Drupal 11 you should generally prefer a newer 6.x release (e.g. 6.0.10), which explicitly declares Drupal core compatibility as ^10.5 || ^11 on the project page. [2]

Sources: [1] migrate_plus 6.0.7 release page, [2] Migrate Plus project page (latest release compatibility).


🌐 Web query:

drupal/migrate_tools 6.0.8 drupal 11 compatibility

💡 Result:

There is no drupal/migrate_tools release 6.0.8 on Drupal.org (the official upstream for the Composer package); the latest stable in the 6.0.x line is 6.0.5. [1], [2]

For Drupal 11 compatibility, migrate_tools 6.0.5 explicitly declares: “Works with Drupal: ^9.1 || ^10 || ^11”, so 6.0.5 is Drupal 11–compatible (per its release metadata). [2]

If you specifically have 6.0.8 in your lockfile, it’s likely coming from a non-Drupal.org source (or a mistaken version reference); in that case, compare your composer.lock “source/dist” to the official release list. [1], [3]

Sources:
[1] Migrate Tools project page (release list / supported cores)
[2] migrate_tools 6.0.5 release page (“Works with Drupal: ^9.1 || ^10 || ^11”)
[3] Drupal.org releases index (shows available tags; no 6.0.8)


Fix drupal/migrate_tools version: 6.0.8 does not exist on Drupal.org.

drupal/migrate_plus: ^6.0.7 is compatible with Drupal 11. However, drupal/migrate_tools: ^6.0.8 does not have a release on Drupal.org; the latest stable in the 6.0.x series is 6.0.5, which is Drupal 11-compatible (^9.1 || ^10 || ^11). Change ^6.0.8 to ^6.0.5. Alternatively, consider upgrading migrate_plus to ^6.0.10 for explicit Drupal 11 support (^10.5 || ^11).

🤖 Prompt for AI Agents
In `@composer.json` around lines 18 - 19, The composer.json references an invalid
release for drupal/migrate_tools (^6.0.8); update the version constraint for
"drupal/migrate_tools" to "^6.0.5" (or to a known valid constraint) and
optionally bump "drupal/migrate_plus" to "^6.0.10" if you want explicit Drupal
11 support; after changing the "drupal/migrate_tools" and/or
"drupal/migrate_plus" entries run composer update drupal/migrate_tools
drupal/migrate_plus to verify the resolved versions and run your test/site build
to ensure compatibility.

Comment on lines +201 to +207
database2:
image: uselagoon/mysql-8.4:26.1.0
environment:
<<: *default-environment
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Align database2 init credentials with DATABASE2_* to avoid mismatches.
If users override DATABASE2_NAME/USERNAME/PASSWORD, the container still bootstraps drupal/drupal, which can break connections.

🔧 Proposed fix
   environment:
     <<: *default-environment
-    MYSQL_DATABASE: drupal
-    MYSQL_USER: drupal
-    MYSQL_PASSWORD: drupal
+    MYSQL_DATABASE: ${DATABASE2_NAME:-drupal}
+    MYSQL_USER: ${DATABASE2_USERNAME:-drupal}
+    MYSQL_PASSWORD: ${DATABASE2_PASSWORD:-drupal}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
database2:
image: uselagoon/mysql-8.4:26.1.0
environment:
<<: *default-environment
MYSQL_DATABASE: drupal
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
database2:
image: uselagoon/mysql-8.4:26.1.0
environment:
<<: *default-environment
MYSQL_DATABASE: ${DATABASE2_NAME:-drupal}
MYSQL_USER: ${DATABASE2_USERNAME:-drupal}
MYSQL_PASSWORD: ${DATABASE2_PASSWORD:-drupal}
🤖 Prompt for AI Agents
In `@docker-compose.yml` around lines 201 - 207, The database2 service currently
hardcodes MYSQL_DATABASE/MYSQL_USER/MYSQL_PASSWORD to "drupal", which conflicts
with the external override variables; update the environment values in the
database2 service so they read from the corresponding override variables (use
DATABASE2_NAME, DATABASE2_USERNAME, DATABASE2_PASSWORD with sensible defaults)
instead of the fixed "drupal" strings; edit the database2 block and replace the
MYSQL_DATABASE, MYSQL_USER and MYSQL_PASSWORD entries to reference those
override variables so container bootstrapping matches runtime overrides.

Comment on lines 111 to 138
# Detect if existing migration source database is corrupted.
if [ "${MIGRATION_SOURCE_DB_IMPORT}" != "1" ]; then
note "Source database import is set to be skipped. Checking existing database."
task "Probing for '${MIGRATION_SOURCE_DB_PROBE_TABLE}' table in the source database."
if ! drush sql:query --database=migrate "SELECT COUNT(*) FROM ${MIGRATION_SOURCE_DB_PROBE_TABLE}" >/dev/null 2>&1; then
note "Migration source database is corrupted or empty. Re-importing."
MIGRATION_SOURCE_DB_IMPORT=1
fi
fi

# Import the migration source database from the dump file.
if [ "${MIGRATION_SOURCE_DB_IMPORT}" = "1" ]; then
task "Importing migration source database."

[ ! -f "${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE}" ] && fail "Migration source database file not found. Please run 'ahoy download-db2'." && exit 1

drush sql:drop --database=migrate
$(drush sql:connect --database=migrate) <"${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE}"

pass "Imported migration source database."
else
note "Using existing migration source database."
fi

task "Verifying migration source database."
if ! drush sql:query --database=migrate "SELECT COUNT(*) FROM ${MIGRATION_SOURCE_DB_PROBE_TABLE}" >/dev/null 2>&1; then
fail "Migration source database is corrupted."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Validate MIGRATION_SOURCE_DB_PROBE_TABLE before interpolating into SQL.
It’s env-driven and currently allows SQL injection (e.g., categories; DROP TABLE ...). Add a strict whitelist check before the first query.

🛡️ Proposed guard
 # Table name to probe in the source database to verify it is not corrupted.
 MIGRATION_SOURCE_DB_PROBE_TABLE="${MIGRATION_SOURCE_DB_PROBE_TABLE:-categories}"
+
+# Allow only simple table identifiers to avoid SQL injection.
+if ! [[ "${MIGRATION_SOURCE_DB_PROBE_TABLE}" =~ ^[A-Za-z0-9_]+$ ]]; then
+  fail "Invalid MIGRATION_SOURCE_DB_PROBE_TABLE: ${MIGRATION_SOURCE_DB_PROBE_TABLE}"
+  exit 1
+fi
🧰 Tools
🪛 GitHub Actions: Vortex - Test

[error] 128-128: ShellCheck SC2091 (warning): Remove surrounding $() to avoid executing output in provision-20-migration.sh.

🤖 Prompt for AI Agents
In `@scripts/custom/provision-20-migration.sh` around lines 111 - 137, The script
interpolates MIGRATION_SOURCE_DB_PROBE_TABLE directly into SQL which allows
injection; add a strict validation step before the first probe (and reuse it
before the final verification) that ensures MIGRATION_SOURCE_DB_PROBE_TABLE
matches an allowlist or a tight regex (e.g., only [a-zA-Z0-9_]+ or compare
against an explicit list of known table names) and abort with a clear fail
message if validation fails; update the checks around the drush sql:query calls
(the probe and the final verification) to rely on the validated value so no
untrusted input is ever concatenated into the SQL.

Comment on lines 125 to 130
[ ! -f "${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE}" ] && fail "Migration source database file not found. Please run 'ahoy download-db2'." && exit 1

drush sql:drop --database=migrate
$(drush sql:connect --database=migrate) <"${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE}"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check if the file exists and view the specific lines
if [ -f "scripts/custom/provision-20-migration.sh" ]; then
  echo "=== File exists. Showing lines 120-135 ==="
  sed -n '120,135p' scripts/custom/provision-20-migration.sh
else
  echo "File not found at scripts/custom/provision-20-migration.sh"
  # Try to find similar files
  find . -name "*provision*migration*" -type f 2>/dev/null | head -20
fi

Repository: drevops/vortex

Length of output: 687


🏁 Script executed:

# Search for other drush sql commands used in the codebase
echo "=== Drush sql command usage in codebase ==="
rg "drush sql:" --type sh --type bash -A 1 -B 1

Repository: drevops/vortex

Length of output: 147


🌐 Web query:

Drush sql:cli command documentation

💡 Result:

Drush sql:cli documentation (Drush 12/13):

  • Command: drush sql:cli — opens a SQL command-line interface using the current Drupal site’s DB credentials. (drush.org)
  • Aliases: sqlc, sql-cli. (drush.org)
  • Common examples:
    • drush sql:cli
    • drush sql:cli --extra=--progress-reports
    • drush sql:cli < example.sql (drush.org)
  • Key options: --extra, --database, --db-url, --target, --show-passwords. (drush.org)

Official docs page (URL in code form):

https://www.drush.org/12.4.3/commands/sql_cli/

Citations:


Fix import command to use proper Drush SQL CLI instead of command substitution.

The current line triggers the ShellCheck SC2091 failure in CI due to the indirect $(drush sql:connect) pattern. Use drush sql:cli instead—a purpose-built Drush command that is officially supported with the --database option.

Fix
-  $(drush sql:connect --database=migrate) <"${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE}"
+  drush sql:cli --database=migrate < "${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE}"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[ ! -f "${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE}" ] && fail "Migration source database file not found. Please run 'ahoy download-db2'." && exit 1
drush sql:drop --database=migrate
$(drush sql:connect --database=migrate) <"${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE}"
[ ! -f "${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE}" ] && fail "Migration source database file not found. Please run 'ahoy download-db2'." && exit 1
drush sql:drop --database=migrate
drush sql:cli --database=migrate < "${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE}"
🧰 Tools
🪛 GitHub Actions: Vortex - Test

[error] 128-128: ShellCheck SC2091 (warning): Remove surrounding $() to avoid executing output in provision-20-migration.sh.

🤖 Prompt for AI Agents
In `@scripts/custom/provision-20-migration.sh` around lines 125 - 129, The current
import uses indirect command substitution with drush sql:connect, which triggers
ShellCheck SC2091; replace that use with the supported drush sql:cli invocation
to run the SQL file into the migrate database. Specifically, keep the drush
sql:drop --database=migrate call, remove the $(drush sql:connect
--database=migrate) <... pattern, and invoke drush sql:cli --database=migrate
with the SQL file redirected into its stdin (using the same
${VORTEX_DB_DIR}/${VORTEX_DOWNLOAD_DB2_FILE} variable) so the import uses
drush's CLI entrypoint instead of command substitution.

Comment on lines 54 to 56
public function prepareRow(Row $row) {
return parent::prepareRow($row);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Drop redundant prepareRow() override. It only calls the parent and adds noise.

♻️ Proposed cleanup
-  public function prepareRow(Row $row) {
-    return parent::prepareRow($row);
-  }
-
🤖 Prompt for AI Agents
In `@web/modules/custom/ys_migrate/src/Plugin/migrate/source/Categories.php`
around lines 54 - 56, The prepareRow() method in the Categories source plugin is
an unnecessary override because it only calls parent::prepareRow($row);; remove
the redundant prepareRow() method from the Categories class to let the inherited
implementation be used and reduce noise (ensure no other code in this class
depends on this method existing before deleting it).

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch 3 times, most recently from a6861ff to 6e25d5d Compare February 10, 2026 21:53
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Fix all issues with AI agents
In @.ahoy.yml:
- Around line 54-61: The db2 command in .ahoy.yml hardcodes the database path as
/drupal; update the command that builds the Sequel Ace URL (the db2 cmd block)
to use the DATABASE2_NAME environment variable with a default fallback (e.g.,
${DATABASE2_NAME:-drupal}) instead of the literal "/drupal" so custom DB names
are respected and the open URL is constructed dynamically.

In @.vortex/docs/.utils/create-migrate-source-db.sh:
- Around line 42-47: The conditional checking "${1:-}" = "--sql" is redundant
because both branches print the same sql variable; change behavior so "--sql"
remains a dry-run/output-only mode and the default path actually executes the
SQL against the configured DB_URL: keep the if block to print and exit when
"${1:-}" = "--sql", and in the else branch replace the echo "${sql}" with logic
that uses DB_URL to run the SQL (e.g., invoke psql/mysql/appropriate client with
DB_URL, handle errors and non-zero exit codes), ensuring you reference the sql
variable and DB_URL and return meaningful exit codes on failure.

In @.vortex/docs/content/drupal/migrations.mdx:
- Around line 146-153: The documentation wrongly lists the source plugin as
`ys_migrate_categories` — that is the migration ID, not the plugin; update the
table for the `ys_migrate_categories` migration to show Source plugin = `table`
(from `migrate_plus`) and, if helpful, add a short note clarifying that
`ys_migrate_categories` is the migration ID while `plugin: table` is the actual
source plugin used in the migration YAML.

In @.vortex/tests/phpunit/Functional/AhoyWorkflowTest.php:
- Around line 265-269: Change the value for VORTEX_INSTALLER_PROMPT_MIGRATION in
the static::$sutInstallerEnv array from the PHP boolean TRUE to the string '1'
to match the other VORTEX_INSTALLER_PROMPT_* and VORTEX_INSTALLER_IS_DEMO
entries; update the array entry where static::$sutInstallerEnv is defined so the
key 'VORTEX_INSTALLER_PROMPT_MIGRATION' has the string '1' instead of TRUE.

In @.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php:
- Around line 793-801: The test subtestAhoyMigrationDownloadDb modifies .env by
adding VORTEX_DOWNLOAD_DB2_URL but never restores it; to prevent test bleed,
save the original .env contents (or the original value of
VORTEX_DOWNLOAD_DB2_URL) before calling fileAddVar, then ensure .env is restored
in a finally/tearDown block (or call a complementary fileRemoveVar/reset method)
after the download/assertion completes; update subtestAhoyMigrationDownloadDb to
capture the prior state, perform the existing actions, and always restore the
original .env value so subsequent tests run with the original environment.

In `@docker-compose.yml`:
- Around line 69-79: The DATABASE2_* entries (DATABASE2_HOST, DATABASE2_NAME,
DATABASE2_USERNAME, DATABASE2_PASSWORD, DATABASE2_PORT) are hardcoded so .env
overrides won't work; update each value to use environment variable substitution
with sensible defaults (e.g. change DATABASE2_HOST: database2 to DATABASE2_HOST:
"${DATABASE2_HOST:-database2}" and do the same pattern for DATABASE2_NAME,
DATABASE2_USERNAME, DATABASE2_PASSWORD, DATABASE2_PORT) so the compose file
reads from .env while preserving existing defaults; also ensure the
corresponding keys exist in the project .env for users to override.

In `@scripts/custom/provision-20-migration.sh`:
- Around line 58-59: The Settings class reference is incorrectly cased in the
drush php:eval call—change "Drupal\core\Site\Settings" to
"Drupal\Core\Site\Settings" in the environment assignment (the line setting
environment="$(drush php:eval "print
\Drupal\core\Site\Settings::get('environment');")") so the autoloader can find
the class on case-sensitive filesystems; update that occurrence to use the
correct namespace casing.

Comment on lines +54 to +61
#;< MIGRATION
db2:
usage: Open DB2 in Sequel Ace.
cmd: |
uname -a | grep -i -q darwin && test -d "${VORTEX_HOST_SEQUELACE_PATH:-/Applications/Sequel Ace.app}" && \
VORTEX_HOST_DB2_PORT=$(docker compose port database2 3306 2>/dev/null | cut -d : -f 2) && \
open "mysql://${DATABASE2_USERNAME:-drupal}:${DATABASE2_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB2_PORT}/drupal" -a "Sequel Ace" \
|| echo "Not a supported OS or Sequel Ace is not installed."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use DATABASE2_NAME in db2 command to respect custom DB names.
Hardcoding /drupal breaks when DB2 name differs from the default.

✏️ Suggested fix
-      open "mysql://${DATABASE2_USERNAME:-drupal}:${DATABASE2_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB2_PORT}/drupal" -a "Sequel Ace" \
+      open "mysql://${DATABASE2_USERNAME:-drupal}:${DATABASE2_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB2_PORT}/${DATABASE2_NAME:-drupal}" -a "Sequel Ace" \
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#;< MIGRATION
db2:
usage: Open DB2 in Sequel Ace.
cmd: |
uname -a | grep -i -q darwin && test -d "${VORTEX_HOST_SEQUELACE_PATH:-/Applications/Sequel Ace.app}" && \
VORTEX_HOST_DB2_PORT=$(docker compose port database2 3306 2>/dev/null | cut -d : -f 2) && \
open "mysql://${DATABASE2_USERNAME:-drupal}:${DATABASE2_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB2_PORT}/drupal" -a "Sequel Ace" \
|| echo "Not a supported OS or Sequel Ace is not installed."
#;< MIGRATION
db2:
usage: Open DB2 in Sequel Ace.
cmd: |
uname -a | grep -i -q darwin && test -d "${VORTEX_HOST_SEQUELACE_PATH:-/Applications/Sequel Ace.app}" && \
VORTEX_HOST_DB2_PORT=$(docker compose port database2 3306 2>/dev/null | cut -d : -f 2) && \
open "mysql://${DATABASE2_USERNAME:-drupal}:${DATABASE2_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB2_PORT}/${DATABASE2_NAME:-drupal}" -a "Sequel Ace" \
|| echo "Not a supported OS or Sequel Ace is not installed."
🤖 Prompt for AI Agents
In @.ahoy.yml around lines 54 - 61, The db2 command in .ahoy.yml hardcodes the
database path as /drupal; update the command that builds the Sequel Ace URL (the
db2 cmd block) to use the DATABASE2_NAME environment variable with a default
fallback (e.g., ${DATABASE2_NAME:-drupal}) instead of the literal "/drupal" so
custom DB names are respected and the open URL is constructed dynamically.

Comment on lines +42 to +47
if [ "${1:-}" = "--sql" ]; then
printf '%s\n' "${sql}"
exit 0
fi

echo "${sql}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Redundant conditional: both branches output identical content.

The --sql flag has no meaningful effect—both paths emit the same SQL to stdout. Consider either:

  1. Removing the --sql flag and always outputting SQL, or
  2. Implementing actual database execution (using DB_URL) in the default path, reserving --sql for dry-run/output-only mode.
💡 Option 1: Simplify by removing the flag
-if [ "${1:-}" = "--sql" ]; then
-  printf '%s\n' "${sql}"
-  exit 0
-fi
-
-echo "${sql}"
+printf '%s\n' "${sql}"
🤖 Prompt for AI Agents
In @.vortex/docs/.utils/create-migrate-source-db.sh around lines 42 - 47, The
conditional checking "${1:-}" = "--sql" is redundant because both branches print
the same sql variable; change behavior so "--sql" remains a dry-run/output-only
mode and the default path actually executes the SQL against the configured
DB_URL: keep the if block to print and exit when "${1:-}" = "--sql", and in the
else branch replace the echo "${sql}" with logic that uses DB_URL to run the SQL
(e.g., invoke psql/mysql/appropriate client with DB_URL, handle errors and
non-zero exit codes), ensuring you reference the sql variable and DB_URL and
return meaningful exit codes on failure.

Comment on lines +146 to +153
### Migration: `ys_migrate_categories`

| Property | Value |
|----------|-------|
| Source plugin | `ys_migrate_categories` (reads from `categories` table) |
| Source key | `migrate` (the `$databases['migrate']` connection) |
| Destination | `entity:taxonomy_term` |
| Vocabulary | `tags` |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Documentation error: incorrect source plugin name.

The table states the source plugin is ys_migrate_categories, but the actual migration YAML uses plugin: table (from migrate_plus). The ID is ys_migrate_categories, not the plugin.

📝 Suggested fix
 | Property | Value |
 |----------|-------|
-| Source plugin | `ys_migrate_categories` (reads from `categories` table) |
+| Source plugin | `table` (reads from `categories` table) |
 | Source key | `migrate` (the `$databases['migrate']` connection) |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
### Migration: `ys_migrate_categories`
| Property | Value |
|----------|-------|
| Source plugin | `ys_migrate_categories` (reads from `categories` table) |
| Source key | `migrate` (the `$databases['migrate']` connection) |
| Destination | `entity:taxonomy_term` |
| Vocabulary | `tags` |
### Migration: `ys_migrate_categories`
| Property | Value |
|----------|-------|
| Source plugin | `table` (reads from `categories` table) |
| Source key | `migrate` (the `$databases['migrate']` connection) |
| Destination | `entity:taxonomy_term` |
| Vocabulary | `tags` |
🤖 Prompt for AI Agents
In @.vortex/docs/content/drupal/migrations.mdx around lines 146 - 153, The
documentation wrongly lists the source plugin as `ys_migrate_categories` — that
is the migration ID, not the plugin; update the table for the
`ys_migrate_categories` migration to show Source plugin = `table` (from
`migrate_plus`) and, if helpful, add a short note clarifying that
`ys_migrate_categories` is the migration ID while `plugin: table` is the actual
source plugin used in the migration YAML.

Comment on lines 265 to 269
static::$sutInstallerEnv = [
'VORTEX_INSTALLER_IS_DEMO' => '1',
'VORTEX_INSTALLER_PROMPT_MIGRATION' => TRUE,
'VORTEX_INSTALLER_PROMPT_MIGRATION_DOWNLOAD_SOURCE' => 'url',
];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for all VORTEX_INSTALLER_PROMPT_* variables to see patterns
rg -n "VORTEX_INSTALLER_PROMPT_" --type=php -C1

Repository: drevops/vortex

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Also check how VORTEX_INSTALLER_IS_DEMO is used across the test file to establish pattern
rg -n "VORTEX_INSTALLER_IS_DEMO" --type=php .vortex/tests/phpunit/Functional/AhoyWorkflowTest.php -C1

Repository: drevops/vortex

Length of output: 1218


🏁 Script executed:

#!/bin/bash
# Check the actual test file around line 267 to see context
head -n 290 .vortex/tests/phpunit/Functional/AhoyWorkflowTest.php | tail -n 50

Repository: drevops/vortex

Length of output: 1960


🏁 Script executed:

#!/bin/bash
# Find the parent class and see how $sutInstallerEnv is used
rg -n "sutInstallerEnv" --type=php -B2 -A2

Repository: drevops/vortex

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Search for how VORTEX_INSTALLER_PROMPT_MIGRATION is read/used in installer code
rg -r "VORTEX_INSTALLER_PROMPT_MIGRATION" --type=php

Repository: drevops/vortex

Length of output: 454


🏁 Script executed:

#!/bin/bash
# Search for how sutInstallerEnv is used
rg "sutInstallerEnv" --type=php

Repository: drevops/vortex

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Search for the test base class
find . -name "*TestBase*" -o -name "*FunctionalTestBase*" | grep -E "\.php$"

Repository: drevops/vortex

Length of output: 12952


🏁 Script executed:

#!/bin/bash
# Search for VORTEX_INSTALLER_PROMPT_MIGRATION in the codebase
rg "VORTEX_INSTALLER_PROMPT_MIGRATION" --type=php

Repository: drevops/vortex

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Check the parent class and beginning of AhoyWorkflowTest to understand the inheritance
head -n 50 .vortex/tests/phpunit/Functional/AhoyWorkflowTest.php

Repository: drevops/vortex

Length of output: 1046


🏁 Script executed:

#!/bin/bash
# Find where the parent test base class is for Ahoy tests
find . -name "AhoyWorkflowTestBase.php" -o -name "*AhoyTest*Base*" 2>/dev/null

Repository: drevops/vortex

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Find FunctionalTestCase class
find . -name "FunctionalTestCase.php" | head -5

Repository: drevops/vortex

Length of output: 175


🏁 Script executed:

#!/bin/bash
# Search for $sutInstallerEnv usage in the codebase more broadly
rg '\$sutInstallerEnv' --type=php -B2 -A2 | head -100

Repository: drevops/vortex

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Read the FunctionalTestCase to see how sutInstallerEnv is used
cat .vortex/tests/phpunit/Functional/FunctionalTestCase.php | head -150

Repository: drevops/vortex

Length of output: 4476


🏁 Script executed:

#!/bin/bash
# Find the SutTrait to see how $sutInstallerEnv is handled
find . -name "SutTrait.php" -type f

Repository: drevops/vortex

Length of output: 101


🏁 Script executed:

#!/bin/bash
# Search for how environment variables are actually set/used in the installer
rg "prepareSut" --type=php -A10 | head -80

Repository: drevops/vortex

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Read SutTrait to understand how $sutInstallerEnv is used
cat ./.vortex/tests/phpunit/Traits/SutTrait.php

Repository: drevops/vortex

Length of output: 29789


🏁 Script executed:

#!/bin/bash
# Check the ProcessTrait to understand how env parameter is handled
find . -name "ProcessTrait.php" -type f | grep -v Fixtures

Repository: drevops/vortex

Length of output: 105


🏁 Script executed:

#!/bin/bash
# Search for how the installer reads VORTEX_INSTALLER_PROMPT_MIGRATION
find . -path "*/.vortex/installer*" -name "*.php" -type f | head -20

Repository: drevops/vortex

Length of output: 1068


🏁 Script executed:

#!/bin/bash
# Search the installer code for how it reads and uses VORTEX_INSTALLER_PROMPT_MIGRATION
rg "VORTEX_INSTALLER_PROMPT_MIGRATION" ./.vortex/installer --type=php -B2 -A2

Repository: drevops/vortex

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Look for getenv or environment variable handling in the installer
rg "getenv|env\[" ./.vortex/installer/src --type=php | grep -i prompt | head -20

Repository: drevops/vortex

Length of output: 40


🏁 Script executed:

#!/bin/bash
# Search for how environment variables are typically cast or used in InstallCommand
head -n 250 ./.vortex/installer/src/Command/InstallCommand.php | tail -n 100

Repository: drevops/vortex

Length of output: 3633


🏁 Script executed:

#!/bin/bash
# Find the Env class to understand how getenv works
find ./.vortex/installer -name "*.php" -type f | xargs grep -l "class Env"

Repository: drevops/vortex

Length of output: 744


🏁 Script executed:

#!/bin/bash
# Search for other VORTEX_INSTALLER_PROMPT usage in installer code
rg "Env::get.*VORTEX_INSTALLER_PROMPT" ./.vortex/installer --type=php -B2 -A2

Repository: drevops/vortex

Length of output: 579


🏁 Script executed:

#!/bin/bash
# Read the Env class to understand how it handles environment variables
cat ./.vortex/installer/src/Utils/Env.php

Repository: drevops/vortex

Length of output: 6873


🏁 Script executed:

#!/bin/bash
# Check the full context around line 267 including the other PROMPT variables
sed -n '260,275p' .vortex/tests/phpunit/Functional/AhoyWorkflowTest.php

Repository: drevops/vortex

Length of output: 572


🏁 Script executed:

#!/bin/bash
# Look for any other VORTEX_INSTALLER_PROMPT settings in the test file
rg "VORTEX_INSTALLER_PROMPT" .vortex/tests/phpunit/Functional/AhoyWorkflowTest.php -n

Repository: drevops/vortex

Length of output: 629


Change VORTEX_INSTALLER_PROMPT_MIGRATION from TRUE to '1' for consistency.

Line 267 uses PHP boolean TRUE, but all other VORTEX_INSTALLER_PROMPT_* variables in this test file use string values (lines 136, 137, 210, 211, 236, 237). Additionally, VORTEX_INSTALLER_IS_DEMO consistently uses string '1' throughout (lines 28, 75, 114). While PHP will convert TRUE to "1" when passed as an environment variable, maintaining consistent types improves code readability and prevents potential type-checking issues.

🤖 Prompt for AI Agents
In @.vortex/tests/phpunit/Functional/AhoyWorkflowTest.php around lines 265 -
269, Change the value for VORTEX_INSTALLER_PROMPT_MIGRATION in the
static::$sutInstallerEnv array from the PHP boolean TRUE to the string '1' to
match the other VORTEX_INSTALLER_PROMPT_* and VORTEX_INSTALLER_IS_DEMO entries;
update the array entry where static::$sutInstallerEnv is defined so the key
'VORTEX_INSTALLER_PROMPT_MIGRATION' has the string '1' instead of TRUE.

Comment on lines 793 to 801
protected function subtestAhoyMigrationDownloadDb(): void {
$this->logStepStart();

$this->fileAddVar('.env', 'VORTEX_DOWNLOAD_DB2_URL', static::VORTEX_INSTALLER_DEMO_DB_TEST);
$this->cmd('ahoy download-db2', txt: 'Download migration database');
$this->assertFileExists('.data/db2.sql', 'Migration database file should exist after download');

$this->logStepFinish();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Restore .env after subtestAhoyMigrationDownloadDb to avoid test bleed.
The test appends VORTEX_DOWNLOAD_DB2_URL but never restores .env, which can leak state into later tests.

🔧 Proposed fix
   $this->fileAddVar('.env', 'VORTEX_DOWNLOAD_DB2_URL', static::VORTEX_INSTALLER_DEMO_DB_TEST);
   $this->cmd('ahoy download-db2', txt: 'Download migration database');
   $this->assertFileExists('.data/db2.sql', 'Migration database file should exist after download');
+
+  $this->fileRestore('.env');
🤖 Prompt for AI Agents
In @.vortex/tests/phpunit/Traits/Subtests/SubtestAhoyTrait.php around lines 793
- 801, The test subtestAhoyMigrationDownloadDb modifies .env by adding
VORTEX_DOWNLOAD_DB2_URL but never restores it; to prevent test bleed, save the
original .env contents (or the original value of VORTEX_DOWNLOAD_DB2_URL) before
calling fileAddVar, then ensure .env is restored in a finally/tearDown block (or
call a complementary fileRemoveVar/reset method) after the download/assertion
completes; update subtestAhoyMigrationDownloadDb to capture the prior state,
perform the existing actions, and always restore the original .env value so
subsequent tests run with the original environment.

Comment on lines +69 to +79
#;< MIGRATION
# Local migration database host (not used in production).
DATABASE2_HOST: database2
# Local migration database name (not used in production).
DATABASE2_NAME: drupal
# Local migration database user (not used in production).
DATABASE2_USERNAME: drupal
# Local migration database password (not used in production).
DATABASE2_PASSWORD: drupal
# Local migration database port (not used in production).
DATABASE2_PORT: 3306
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Wire DATABASE2_* to env substitutions.

These values are hardcoded, so .env overrides won’t apply and the new configuration options won’t work as intended.

🔧 Proposed fix
-  DATABASE2_HOST: database2
-  DATABASE2_NAME: drupal
-  DATABASE2_USERNAME: drupal
-  DATABASE2_PASSWORD: drupal
-  DATABASE2_PORT: 3306
+  DATABASE2_HOST: ${DATABASE2_HOST:-database2}
+  DATABASE2_NAME: ${DATABASE2_NAME:-drupal}
+  DATABASE2_USERNAME: ${DATABASE2_USERNAME:-drupal}
+  DATABASE2_PASSWORD: ${DATABASE2_PASSWORD:-drupal}
+  DATABASE2_PORT: ${DATABASE2_PORT:-3306}
🤖 Prompt for AI Agents
In `@docker-compose.yml` around lines 69 - 79, The DATABASE2_* entries
(DATABASE2_HOST, DATABASE2_NAME, DATABASE2_USERNAME, DATABASE2_PASSWORD,
DATABASE2_PORT) are hardcoded so .env overrides won't work; update each value to
use environment variable substitution with sensible defaults (e.g. change
DATABASE2_HOST: database2 to DATABASE2_HOST: "${DATABASE2_HOST:-database2}" and
do the same pattern for DATABASE2_NAME, DATABASE2_USERNAME, DATABASE2_PASSWORD,
DATABASE2_PORT) so the compose file reads from .env while preserving existing
defaults; also ensure the corresponding keys exist in the project .env for users
to override.

Comment on lines +58 to +59
environment="$(drush php:eval "print \Drupal\core\Site\Settings::get('environment');")"
note "Environment: ${environment}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

head -70 scripts/custom/provision-20-migration.sh | tail -20

Repository: drevops/vortex

Length of output: 771


🏁 Script executed:

# Search for namespace usage patterns in Drupal codebase or docs
rg "Drupal\\\\(core|Core)" --max-count=5 -t sh -t php

Repository: drevops/vortex

Length of output: 1425


🌐 Web query:

Drupal PSR-4 autoloading namespace casing requirements Core Site Settings

💡 Result:

Drupal (core + contrib/custom) follows PSR-4, which has strict casing requirements:

  • Class names must be referenced case-sensitively. (So your use / FQCN casing must match.) [1]
  • Each sub-namespace maps to a subdirectory, and the directory name MUST match the sub-namespace’s case. [1]
  • The .php filename MUST match the class name’s case. [1]

What this means in Drupal

  • A module class like Drupal\my_module\Foo\Bar must live at my_module/src/Foo/Bar.php (note: src is not part of the namespace), and Foo/Bar.php casing must match exactly. Drupal’s OO conventions document this PSR-4 mapping. [2]

“Core Site Settings” example (Drupal core)

Drupal core’s Settings class is a canonical example of correct casing:

  • Namespace: Drupal\Core\Site
  • Class: Settings
  • File: core/lib/Drupal/Core/Site/Settings.php [3]

If any segment were cased differently (e.g., core/lib/Drupal/core/Site/settings.php), a PSR-4 autoloader can fail—especially on case-sensitive filesystems (common in Linux production).

Sources: PSR-4 spec [1], Drupal OO/PSR-4 conventions [2], Drupal core Settings API page showing namespace + file path [3].

[1] https://www.php-fig.org/psr/psr-4/
[2] https://docs.w3cub.com/drupal~8/core-core.api.php/group/oo_conventions/8.1.x
[3] https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Site%21Settings.php/11.x


Fix Drupal Settings class casing to avoid autoload failure.

Drupal\core\Site\Settings should be Drupal\Core\Site\Settings; on case-sensitive filesystems this will fail to autoload and break environment detection.

🔧 Proposed fix
-environment="$(drush php:eval "print \Drupal\core\Site\Settings::get('environment');")"
+environment="$(drush php:eval "print \Drupal\Core\Site\Settings::get('environment');")"
🤖 Prompt for AI Agents
In `@scripts/custom/provision-20-migration.sh` around lines 58 - 59, The Settings
class reference is incorrectly cased in the drush php:eval call—change
"Drupal\core\Site\Settings" to "Drupal\Core\Site\Settings" in the environment
assignment (the line setting environment="$(drush php:eval "print
\Drupal\core\Site\Settings::get('environment');")") so the autoloader can find
the class on case-sensitive filesystems; update that occurrence to use the
correct namespace casing.

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch 2 times, most recently from 3b75ac7 to ca0fefa Compare February 10, 2026 23:06
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.vortex/docs/content/drupal/migrations.mdx:
- Line 43: The docs show DATABASE2_PORT defaulting to 3306 but the
settings.migration.php example sets DATABASE2_PORT to an empty string; make them
consistent by updating one side: either change the table row in migrations.mdx
for `DATABASE2_PORT` to reflect an empty string default, or update the
`settings.migration.php` example to set DATABASE2_PORT to `3306` (adjust the
example variable assignment and any surrounding comments). Ensure the symbol
DATABASE2_PORT is updated in both the table and the settings example so both
sources match.

| `DATABASE2_NAME` | `drupal` | Migration database name |
| `DATABASE2_USERNAME` | `drupal` | Migration database user |
| `DATABASE2_PASSWORD` | `drupal` | Migration database password |
| `DATABASE2_PORT` | `3306` | Migration database port |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent default for DATABASE2_PORT.

The documentation table shows DATABASE2_PORT defaults to 3306, but the settings.migration.php example on line 77 defaults to an empty string (''). These should be consistent to avoid confusion.

📝 Proposed fix

Either update the table to match the code:

-| `DATABASE2_PORT` | `3306` | Migration database port |
+| `DATABASE2_PORT` | _(empty)_ | Migration database port |

Or update the settings.migration.php example to use 3306:

-  'port' => getenv('DATABASE2_PORT') ?: '',
+  'port' => getenv('DATABASE2_PORT') ?: '3306',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `DATABASE2_PORT` | `3306` | Migration database port |
| `DATABASE2_PORT` | _(empty)_ | Migration database port |
🤖 Prompt for AI Agents
In @.vortex/docs/content/drupal/migrations.mdx at line 43, The docs show
DATABASE2_PORT defaulting to 3306 but the settings.migration.php example sets
DATABASE2_PORT to an empty string; make them consistent by updating one side:
either change the table row in migrations.mdx for `DATABASE2_PORT` to reflect an
empty string default, or update the `settings.migration.php` example to set
DATABASE2_PORT to `3306` (adjust the example variable assignment and any
surrounding comments). Ensure the symbol DATABASE2_PORT is updated in both the
table and the settings example so both sources match.

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch from ca0fefa to cea8f46 Compare February 10, 2026 23:27
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.github/workflows/build-test-deploy.yml:
- Around line 142-145: Set the VORTEX_DOWNLOAD_DB2_FILE env var in the workflow
step that runs download-db.sh so the migration download writes to db2.sql
instead of the default db.sql; specifically, modify the step that sets
VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 to also export
VORTEX_DOWNLOAD_DB2_FILE=db2.sql so the remapping logic in download-db.sh (which
maps VORTEX_DOWNLOAD_DB2_* → VORTEX_DOWNLOAD_DB_*) doesn't cause the migration
dump to overwrite the primary dump and so the subsequent copy check for
.data/${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql} succeeds.

In `@tests/phpunit/Drupal/DatabaseSettingsTest.php`:
- Around line 186-222: Add a new test case to the data provider in
DatabaseSettingsTest that verifies the DATABASE2_DATABASE fallback when
DATABASE2_NAME is absent: duplicate the existing dataset that uses
DATABASE2_NAME (the array block shown) but replace 'DATABASE2_NAME' with
'DATABASE2_DATABASE' in the input env array and set the expected migrate =>
default => database value to 'migrate_db_via_database_key'; ensure the new entry
follows the same structure and phpcs ignore markers as the other cases so the
test method in DatabaseSettingsTest exercises the fallback.

Comment on lines +142 to +145
#;< MIGRATION
- name: Download migration DB
run: VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
#;> MIGRATION
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Run the command from the review comment to find references
rg -nP "VORTEX_DOWNLOAD_DB2_(FILE|DIR)|VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2"

Repository: drevops/vortex

Length of output: 497


🏁 Script executed:

#!/bin/bash
# First, let's look at the actual workflow file around lines 142-145 and 348-351
cat -n .github/workflows/build-test-deploy.yml | sed -n '135,155p'
echo "---"
cat -n .github/workflows/build-test-deploy.yml | sed -n '340,360p'

Repository: drevops/vortex

Length of output: 2275


🏁 Script executed:

#!/bin/bash
# Check if the download-db.sh script exists and examine it
find . -name "download-db.sh" -type f

Repository: drevops/vortex

Length of output: 89


🏁 Script executed:

#!/bin/bash
# Examine the download-db.sh script
wc -l ./scripts/vortex/download-db.sh

Repository: drevops/vortex

Length of output: 92


🏁 Script executed:

#!/bin/bash
# Read the download-db.sh script to understand its behavior
cat -n ./scripts/vortex/download-db.sh

Repository: drevops/vortex

Length of output: 4519


🏁 Script executed:

#!/bin/bash
# Look for how VORTEX_VAR_PREFIX is used in the codebase
rg -nA5 "VORTEX_VAR_PREFIX" ./scripts

Repository: drevops/vortex

Length of output: 4298


Set VORTEX_DOWNLOAD_DB2_FILE=db2.sql to prevent migration download from overwriting the primary database dump.

When VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 is used, the script remaps any VORTEX_DOWNLOAD_DB2_* environment variables to VORTEX_DOWNLOAD_DB_* (line 15 of download-db.sh). Without an explicit VORTEX_DOWNLOAD_DB2_FILE env var, the script defaults to db.sql (line 32), writing to the same location as the primary dump. The later copy step at lines 348-351 checks for .data/${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql}, which defaults to db2.sql when the variable is unset, causing the file check to fail and the migration DB to not be copied into the container.

🔧 Suggested fix
       - name: Download migration DB
         run: VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 ./scripts/vortex/download-db.sh
+        env:
+          VORTEX_DOWNLOAD_DB2_FILE: db2.sql
+          VORTEX_DOWNLOAD_DB2_DIR: .data

Applies to lines 142-145 and 348-351.

🤖 Prompt for AI Agents
In @.github/workflows/build-test-deploy.yml around lines 142 - 145, Set the
VORTEX_DOWNLOAD_DB2_FILE env var in the workflow step that runs download-db.sh
so the migration download writes to db2.sql instead of the default db.sql;
specifically, modify the step that sets VORTEX_VAR_PREFIX=VORTEX_DOWNLOAD_DB2 to
also export VORTEX_DOWNLOAD_DB2_FILE=db2.sql so the remapping logic in
download-db.sh (which maps VORTEX_DOWNLOAD_DB2_* → VORTEX_DOWNLOAD_DB_*) doesn't
cause the migration dump to overwrite the primary dump and so the subsequent
copy check for .data/${VORTEX_DOWNLOAD_DB2_FILE:-db2.sql} succeeds.

Comment on lines +186 to +222
// phpcs:ignore #;< MIGRATION
[
[
'DATABASE2_NAME' => 'migrate_db_name',
'DATABASE2_USERNAME' => 'migrate_db_user',
'DATABASE2_PASSWORD' => 'migrate_db_pass',
'DATABASE2_HOST' => 'migrate_db_host',
'DATABASE2_PORT' => '3307',
],
[
'default' => [
'default' => [
'database' => 'drupal',
'username' => 'drupal',
'password' => 'drupal',
'host' => 'localhost',
'port' => '3306',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'driver' => 'mysql',
'prefix' => '',
],
],
'migrate' => [
'default' => [
'database' => 'migrate_db_name',
'username' => 'migrate_db_user',
'password' => 'migrate_db_pass',
'host' => 'migrate_db_host',
'port' => '3307',
'prefix' => '',
'driver' => 'mysql',
],
],
],
],
// phpcs:ignore #;> MIGRATION
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider adding test coverage for the DATABASE2_DATABASE fallback.

This test case correctly validates that DATABASE2_* environment variables populate the migrate connection. However, per the PR objectives, DATABASE2_NAME should fall back to DATABASE2_DATABASE when not set. Consider adding a test case to verify this fallback behavior:

[
  [
    'DATABASE2_DATABASE' => 'migrate_db_via_database_key',
    'DATABASE2_USERNAME' => 'migrate_db_user',
    'DATABASE2_PASSWORD' => 'migrate_db_pass',
    'DATABASE2_HOST' => 'migrate_db_host',
    'DATABASE2_PORT' => '3307',
  ],
  [
    'default' => [
      'default' => [
        // ... default values
      ],
    ],
    'migrate' => [
      'default' => [
        'database' => 'migrate_db_via_database_key',
        // ... rest of migrate config
      ],
    ],
  ],
],
🤖 Prompt for AI Agents
In `@tests/phpunit/Drupal/DatabaseSettingsTest.php` around lines 186 - 222, Add a
new test case to the data provider in DatabaseSettingsTest that verifies the
DATABASE2_DATABASE fallback when DATABASE2_NAME is absent: duplicate the
existing dataset that uses DATABASE2_NAME (the array block shown) but replace
'DATABASE2_NAME' with 'DATABASE2_DATABASE' in the input env array and set the
expected migrate => default => database value to 'migrate_db_via_database_key';
ensure the new entry follows the same structure and phpcs ignore markers as the
other cases so the test method in DatabaseSettingsTest exercises the fallback.

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch from cea8f46 to f914b78 Compare February 10, 2026 23:56
@github-actions

This comment has been minimized.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 00:03:14

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/vortex/download-db-s3.sh (1)

13-39: ⚠️ Potential issue | 🟠 Major

Relocate these changes to scripts/custom/ and keep scripts/vortex/ untouched.

Repo guidelines forbid modifying scripts under scripts/vortex/. Please move the prefix/default logic into a custom script (or wrapper) under scripts/custom/, update callers to use it, and restore this file to its original content.

🛠️ Suggested fix (restore core script; move customization to scripts/custom)
-_vortex_var_prefix_default="VORTEX_DOWNLOAD_DB"
-VORTEX_VAR_PREFIX="${VORTEX_VAR_PREFIX:-${_vortex_var_prefix_default}}"
-for v in $(env | grep "^${VORTEX_VAR_PREFIX}_" | cut -d= -f1); do export "${_vortex_var_prefix_default}_${v#"${VORTEX_VAR_PREFIX}"_}=${!v}"; done
-
 # Directory with database dump file.
-VORTEX_DOWNLOAD_DB_S3_DB_DIR="${VORTEX_DOWNLOAD_DB_S3_DB_DIR:-${VORTEX_DOWNLOAD_DB_DIR:-${VORTEX_DB_DIR:-./.data}}}"
+VORTEX_DOWNLOAD_DB_S3_DB_DIR="${VORTEX_DOWNLOAD_DB_S3_DB_DIR:-./.data}"

 # Database dump file name.
-VORTEX_DOWNLOAD_DB_S3_DB_FILE="${VORTEX_DOWNLOAD_DB_S3_DB_FILE:-${VORTEX_DOWNLOAD_DB_FILE:-${VORTEX_DB_FILE:-db.sql}}}"
+VORTEX_DOWNLOAD_DB_S3_DB_FILE="${VORTEX_DOWNLOAD_DB_S3_DB_FILE:-db.sql}"

As per coding guidelines, "Never modify scripts/vortex/ - use scripts/custom/ for custom scripts".

🤖 Fix all issues with AI agents
In @.vortex/tests/bats/unit/provision-migration.bats:
- Around line 234-264: The test "Provision migration: missing dump file" can be
flaky if prior tests left ./.data/db2.sql behind; at the start of the Bats test
(inside the test block for "Provision migration: missing dump file") explicitly
remove or truncate the dump file (e.g., rm -f ./.data/db2.sql) to guarantee
isolation, or add that cleanup to the shared setup/teardown used by the suite;
update the test block around the existing pushd "${LOCAL_REPO_DIR}" sequence
(the bats test function) to perform this explicit cleanup before running the
rest of the test steps.

Comment on lines +234 to +264
@test "Provision migration: missing dump file" {
pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1

rm ./.env && touch ./.env

# Do NOT create .data/db2.sql.

create_global_command_wrapper "vendor/bin/drush"

export MIGRATION_SOURCE_DB_IMPORT=1

declare -a STEPS=(
"@drush -y php:eval print \Drupal\core\Site\Settings::get('environment'); # local"

"Importing migration source database."
"Migration source database file not found."

"- Imported migration source database."
"- Starting migrations."
"- Finished migration operations."
)

mocks="$(run_steps "setup")"

run ./scripts/custom/provision-20-migration.sh
assert_failure

run_steps "assert" "${mocks[@]}"

popd >/dev/null || exit 1
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Ensure test isolation by clearing any prior db2.sql.

Earlier tests create ./.data/db2.sql. If that file persists, this “missing dump file” test can pass/fail incorrectly depending on execution order. Add an explicit cleanup at the start (or in shared setup/teardown).

🧹 Proposed fix
  rm ./.env && touch ./.env

  # Do NOT create .data/db2.sql.
+ rm -f "./.data/db2.sql"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@test "Provision migration: missing dump file" {
pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1
rm ./.env && touch ./.env
# Do NOT create .data/db2.sql.
create_global_command_wrapper "vendor/bin/drush"
export MIGRATION_SOURCE_DB_IMPORT=1
declare -a STEPS=(
"@drush -y php:eval print \Drupal\core\Site\Settings::get('environment'); # local"
"Importing migration source database."
"Migration source database file not found."
"- Imported migration source database."
"- Starting migrations."
"- Finished migration operations."
)
mocks="$(run_steps "setup")"
run ./scripts/custom/provision-20-migration.sh
assert_failure
run_steps "assert" "${mocks[@]}"
popd >/dev/null || exit 1
}
`@test` "Provision migration: missing dump file" {
pushd "${LOCAL_REPO_DIR}" >/dev/null || exit 1
rm ./.env && touch ./.env
# Do NOT create .data/db2.sql.
rm -f "./.data/db2.sql"
create_global_command_wrapper "vendor/bin/drush"
export MIGRATION_SOURCE_DB_IMPORT=1
declare -a STEPS=(
"@drush -y php:eval print \Drupal\core\Site\Settings::get('environment'); # local"
"Importing migration source database."
"Migration source database file not found."
"- Imported migration source database."
"- Starting migrations."
"- Finished migration operations."
)
mocks="$(run_steps "setup")"
run ./scripts/custom/provision-20-migration.sh
assert_failure
run_steps "assert" "${mocks[@]}"
popd >/dev/null || exit 1
}
🤖 Prompt for AI Agents
In @.vortex/tests/bats/unit/provision-migration.bats around lines 234 - 264, The
test "Provision migration: missing dump file" can be flaky if prior tests left
./.data/db2.sql behind; at the start of the Bats test (inside the test block for
"Provision migration: missing dump file") explicitly remove or truncate the dump
file (e.g., rm -f ./.data/db2.sql) to guarantee isolation, or add that cleanup
to the shared setup/teardown used by the suite; update the test block around the
existing pushd "${LOCAL_REPO_DIR}" sequence (the bats test function) to perform
this explicit cleanup before running the rest of the test steps.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 00:06:58

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch from f914b78 to 360a319 Compare February 11, 2026 00:40
@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 00:47:01

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@github-actions

This comment has been minimized.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 00:51:11

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch from 360a319 to 7fae34e Compare February 11, 2026 02:26
@github-actions

This comment has been minimized.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 02:32:59

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 02:36:16

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch from 7fae34e to 4c8f193 Compare February 11, 2026 03:33
@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 03:39:39

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@github-actions

This comment has been minimized.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 03:43:35

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch from 4c8f193 to d9498a4 Compare February 11, 2026 04:37
@github-actions

This comment has been minimized.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 04:44:33

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 04:47:38

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch from d9498a4 to 5f975f0 Compare February 11, 2026 05:07
@github-actions

This comment has been minimized.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 05:14:01

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 05:16:54

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch from 5f975f0 to b3255c2 Compare February 11, 2026 05:20
@github-actions

This comment has been minimized.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 05:27:55

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 05:30:49

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch from b3255c2 to e20dc7a Compare February 11, 2026 05:55
@github-actions

This comment has been minimized.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 06:02:09

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 06:06:12

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@github-actions

This comment has been minimized.

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 07:01:45

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 07:04:35

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@github-actions

This comment has been minimized.

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1642-add-migration-db branch from 55fa555 to 844122c Compare February 11, 2026 19:56
@github-actions
Copy link

Code Coverage Report:
  2026-02-11 20:03:24

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 20:03:53

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

@AlexSkrypnyk
Copy link
Member Author

Code Coverage Report:
  2026-02-11 20:06:35

 Summary:
  Classes:  0.00% (0/1)
  Methods:  0.00% (0/2)
  Lines:   94.12% (176/187)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: BACKLOG

Development

Successfully merging this pull request may close these issues.

Add an option to use a second DB for migrations

1 participant