This demo page is sourced from the Vortex database dump file to demonstrate database importing capabilities.
', - 'format' => 'basic_html', - ], -])->save();" - -drush config:set system.site page.front "/node/1" -y -drush sql:query "SHOW TABLES LIKE 'cache_%'" | xargs -I{} drush sql:query "TRUNCATE TABLE {}" && drush sql:query "TRUNCATE TABLE watchdog" - -exit - -``` -3. Export DB: -```shell -ahoy export-db db.demo.sql -``` -4. Upload `db.demo.sql` to the latest release as an asset and name it `db_d11.demo.sql`. - -This demo page is sourced from the Vortex database container image to demonstrate database importing capabilities.
', - 'format' => 'basic_html', - ], -])->save();" +Without arguments, runs `all` for a full refresh. Default tag is `latest`. -drush config:set system.site page.front "/node/1" -y -drush sql:query "SHOW TABLES LIKE 'cache_%'" | xargs -I{} drush sql:query "TRUNCATE TABLE {}" && drush sql:query "TRUNCATE TABLE watchdog" +### Modes -exit +| Mode | What it does | Follow-up | +| --- | --- | --- | +| `demo-dump` | Builds the demo profile in-place; exports `.data/db.demo.sql`. | Upload as `db.demo.sql` to the latest GitHub release. | +| `demo-image` | Builds the demo profile in-place; pushes `drevops/vortex-dev-mariadb-drupal-data-demo-11.x:This test page is sourced from the Vortex database dump file to demonstrate database importing capabilities.
', - 'format' => 'basic_html', - ], -])->save();" - -drush config:set system.site page.front "/node/1" -y -drush sql:query "SHOW TABLES LIKE 'cache_%'" | xargs -I{} drush sql:query "TRUNCATE TABLE {}" && drush sql:query "TRUNCATE TABLE watchdog" - -exit +### Requirements -``` -4. Export DB: -```shell -ahoy export-db db.test.sql -``` -5. Upload `db.test.sql` to the latest release as an asset and name it `db_d11.test.sql`. +- `docker`, `ahoy`, `curl`, `sed`, `php` available on `PATH`. +- A Docker Hub session with push permission to `drevops/` for any image mode. -This test page is sourced from the Vortex database container image to demonstrate database importing capabilities.
', - 'format' => 'basic_html', - ], -])->save();" +# Full refresh of every asset at :latest (default). +php .vortex/tests/update-test-assets -drush config:set system.site page.front "/node/1" -y -drush sql:query "SHOW TABLES LIKE 'cache_%'" | xargs -I{} drush sql:query "TRUNCATE TABLE {}" && drush sql:query "TRUNCATE TABLE watchdog" - -exit - -``` -4. Export DB: -```shell -ahoy export-db db.test_image.sql +# Full refresh, tagging images as :rc1. +php .vortex/tests/update-test-assets --tag rc1 -# Update the collation to avoid issues with MariaDB 10.5+: -sed -i '' 's/utf8mb4_0900_ai_ci/utf8mb4_general_ci/g' .data/db.test_image.sql -``` -5. Seed the database container image: -```shell -curl -LO https://github.com/drevops/mariadb-drupal-data/releases/latest/download/seed.sh -chmod +x seed.sh -./seed.sh .data/db.test_image.sql drevops/vortex-dev-mariadb-drupal-data-test-11.x:latest -``` -6. Update destination container images: -```shell -docker tag drevops/vortex-dev-mariadb-drupal-data-demo-11.x:latest drevops/vortex-dev-mariadb-drupal-data-demo-destination-11.x:vortex-dev-database-ii -docker push drevops/vortex-dev-mariadb-drupal-data-demo-destination-11.x:vortex-dev-database-ii +# Refresh only the test container image at :latest. +php .vortex/tests/update-test-assets test-image -docker tag drevops/vortex-dev-mariadb-drupal-data-demo-11.x:latest drevops/vortex-dev-mariadb-drupal-data-demo-destination-11.x:vortex-dev-didi-database-fi -docker push drevops/vortex-dev-mariadb-drupal-data-demo-destination-11.x:vortex-dev-didi-database-fi +# Refresh only the test container image at :rc1. +php .vortex/tests/update-test-assets test-image --tag rc1 ``` - -%s
", "format" => "basic_html"]);', $body_escaped), + '$node->setPublished();', + 'if ($node->hasField("moderation_state")) { $node->set("moderation_state", "published"); }', + '$node->setNewRevision(FALSE);', + '$node->save();', + 'echo "Updated node " . $node->id() . PHP_EOL;', + '} else {', + '$node = $storage->create([', + sprintf('"type" => "page", "title" => "%s",', $title_escaped), + sprintf('"body" => ["value" => "%s
", "format" => "basic_html"],', $body_escaped), + '"status" => 1,', + '"uid" => 1,', + ']);', + 'if ($node->hasField("moderation_state")) { $node->set("moderation_state", "published"); }', + '$node->save();', + 'echo "Created node " . $node->id() . PHP_EOL;', + '}', + // Reload and verify post-save state. + '$storage->resetCache([1]);', + '$node = $storage->load(1);', + 'if (!$node) { throw new \RuntimeException("Node 1 missing after save."); }', + 'if (!$node->isPublished()) { throw new \RuntimeException("Node 1 is not published."); }', + sprintf('if ($node->getTitle() !== "%s") { throw new \RuntimeException("Title mismatch: " . $node->getTitle()); }', $title_escaped), + sprintf('$expected_body = "%s
";', $body_escaped), + 'if ($node->get("body")->value !== $expected_body) { throw new \RuntimeException("Body mismatch: " . $node->get("body")->value); }', + '$mod_state = $node->hasField("moderation_state") ? $node->get("moderation_state")->value : "(no moderation)";', + 'echo "Verified node 1: published=1, title=\"" . $node->getTitle() . "\", body length=" . strlen($node->get("body")->value) . ", moderation_state=" . $mod_state . PHP_EOL;', + ]); +}