-
-
Save briantully/279174ab9300129e2fa31b8df96a2ed5 to your computer and use it in GitHub Desktop.
Revisions
-
adamzimmermann revised this gist
Mar 14, 2019 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -56,13 +56,13 @@ migrate_loop() if [ "$1" == "reset" ]; then printf "\\nResetting migration status...\\n\\n" drush cr >/dev/null 2>&1 drush migrate:status --format=var_export | grep -o "\\w*example_\\w*" | grep -v "example_migration" | xargs -n1 drush migrate:stop drush migrate:status --format=var_export | grep -o "\\w*example_\\w*" | grep -v "example_migration" | xargs -n1 drush migrate:reset-status printf "\\n\\nMigration status reset. Run ./scripts/migrate.sh to start migrating data or ./scripts/migrate.sh rollback to rollback data as well.\\n\\n" elif [ "$1" == "rollback" ]; then drush migrate:status --format=var_export | grep -o "\\w*example_\\w*" | grep -v "example_migration" | xargs -n1 drush migrate:stop drush migrate:status --format=var_export | grep -o "\\w*example_\\w*" | grep -v "example_migration" | xargs -n1 drush migrate:reset-status drush migrate:status --format=var_export | grep -o "\\w*example_\\w*" | grep -v "example_migration" | xargs -n1 drush migrate:rollback printf "\\n\\nMigration rolled back. Run ./scripts/migrate.sh to start migrating data.\\n\\n" else printf "Updating database and entity definitions...\\n" -
adamzimmermann revised this gist
Mar 1, 2019 . 1 changed file with 32 additions and 38 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ #!/bin/bash migrate_loop() @@ -9,52 +8,49 @@ migrate_loop() drush_output=$(drush ms "$1" --format string); # Split output string into an array. output=( $drush_output ) # Output the status items. for index in "${!output[@]}" do if [ "$index" == "3" ] then echo "Migration: ${output[index]}"; fi if [ "$index" == "4" ] then echo "Status: ${output[index]}"; fi if [ "$index" == "5" ] then echo "Total: ${output[index]}"; fi if [ "$index" == "6" ] then echo "Imported: ${output[index]}"; fi if [ "$index" == "7" ] then echo "Remaining: ${output[index]}"; fi done # Check if all items were imported. if [ "${output[7]}" == "0" ] || [ "${output[7]}" -lt "0" ] then echo "No items left to import."; else echo "There are ${output[7]} remaining ${output[3]} items to be imported."; echo "Running command: drush migrate:import $1"; echo "..."; # Run the migration until it stops. drush migrate:reset "$1"; drush migrate:import "$1" --feedback 1000 --limit 10000; # Run the check on this migration again. migrate_loop "$1"; fi } if [ "$1" == "reset" ]; then @@ -72,9 +68,7 @@ else printf "Updating database and entity definitions...\\n" drush updb -y >/dev/null 2>&1 drush entup -y >/dev/null 2>&1 migrate_loop example_migration migrate_loop another_example_migration migrate_loop my_example_migration fi -
adamzimmermann created this gist
Mar 1, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,80 @@ ``` #!/bin/bash migrate_loop() { # Better readability with separation. echo "========================"; # Get the output of the drush status. drush_output=$(drush ms "$1" --format string); # Split output string into an array. # shellcheck disable=SC2206 output=( $drush_output ) # Output the status items. for index in "${!output[@]}" do if [ "$index" == "3" ] then echo "Migration: ${output[index]}"; fi if [ "$index" == "4" ] then echo "Status: ${output[index]}"; fi if [ "$index" == "5" ] then echo "Total: ${output[index]}"; fi if [ "$index" == "6" ] then echo "Imported: ${output[index]}"; fi if [ "$index" == "7" ] then echo "Remaining: ${output[index]}"; fi done # Check if all items were imported. if [ "${output[7]}" == "0" ] || [ "${output[7]}" -lt "0" ] then echo "No items left to import."; else echo "There are ${output[7]} remaining ${output[3]} items to be imported."; echo "Running command: drush migrate:import $1"; echo "..."; # Run the migration until it stops. drush migrate:reset "$1"; drush migrate:import "$1" --feedback 1000 --limit 10000; # Run the check on this migration again. migrate_loop "$1"; fi } if [ "$1" == "reset" ]; then printf "\\nResetting migration status...\\n\\n" drush cr >/dev/null 2>&1 drush migrate:status --format=var_export | grep -o "\\w*rpx_\\w*" | grep -v "rpx_migration" | xargs -n1 drush migrate:stop drush migrate:status --format=var_export | grep -o "\\w*rpx_\\w*" | grep -v "rpx_migration" | xargs -n1 drush migrate:reset-status printf "\\n\\nMigration status reset. Run ./scripts/migrate.sh to start migrating data or ./scripts/migrate.sh rollback to rollback data as well.\\n\\n" elif [ "$1" == "rollback" ]; then drush migrate:status --format=var_export | grep -o "\\w*rpx_\\w*" | grep -v "rpx_migration" | xargs -n1 drush migrate:stop drush migrate:status --format=var_export | grep -o "\\w*rpx_\\w*" | grep -v "rpx_migration" | xargs -n1 drush migrate:reset-status drush migrate:status --format=var_export | grep -o "\\w*rpx_\\w*" | grep -v "rpx_migration" | xargs -n1 drush migrate:rollback printf "\\n\\nMigration rolled back. Run ./scripts/migrate.sh to start migrating data.\\n\\n" else printf "Updating database and entity definitions...\\n" drush updb -y >/dev/null 2>&1 drush entup -y >/dev/null 2>&1 migrate_loop rpx_user migrate_loop rpx_lead_sales_territory migrate_loop rpx_profile ... migrate_loop rpx_private_file fi