Repository navigation
Expand file tree
/
Copy pathmigrate-all.sh
More file actions
executable file
·61 lines (45 loc) · 1.67 KB
/
Copy pathmigrate-all.sh
File metadata and controls
executable file
·61 lines (45 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -xe
if [ -n "$VCAP_APPLICATION" ] && [ "$environment" != "dev" ]; then
echo "Migrations should only run locally or in dev not in {$environment}".
exit 1;
fi
echo "You are about to migrate all content, this will delete existing content in this instance."
read -p "Are you sure you want to proceed (Y/y to proceed)? " CONFIRM
if [ "$CONFIRM" != "Y" ] && [ "$CONFIRM" != "y" ]; then
echo "Migrations skipped."
exit 1;
fi
echo "OK";
# Ensure in the app directory.
cd "$(dirname "$0")"
DRUSH_BIN="./drush.sh"
[ -n "$VCAP_APPLICATION" ] && DRUSH_BIN="drush"
# Runs all the migration steps in the expected order
# 1. Remove content created by default content that will be imported by the
# scripts.
${DRUSH_BIN} rcbm
# 2. Build the feed for s3files that are directly linked in markdown,
# not with the asset short code
${DRUSH_BIN} digitalgov:s3feed > web/sites/default/files/s3files.json
cat web/sites/default/files/s3files.json
if [ -n "$VCAP_APPLICATION" ]; then
drush s3fs-rc
drush s3fs-cl -y --scheme=public --condition=newer
fi
# 3. Run all the migrations.
${DRUSH_BIN} cr
# Throws notices that kill the script.
${DRUSH_BIN} migrate:rollback --tag="digitalgov"
${DRUSH_BIN} migrate:rollback --tag="digitalgov-guidenav"
${DRUSH_BIN} migrate:import --tag="digitalgov"
${DRUSH_BIN} migrate:import --tag="digitalgov-guidenav"
if [ -n "$VCAP_APPLICATION" ]; then
drush s3fs-rc
drush s3fs-cl -y --scheme=public --condition=newer
fi
# 4. Clean up migrated content (shortcodes, media links, emoji).
${DRUSH_BIN} digitalgov:update-nodes
${DRUSH_BIN} digitalgov:update-paragraphs
rm ./web/sites/default/files/s3files.json
echo "Run migrate-messages.sh to check for errors."