Skip to content

Commit e7417b0

Browse files
committed
bluebird - Define a specific workflow for SQL template override
1 parent c7d588e commit e7417b0

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## FIXME: Bluebird-CRM.git has outdated SQL templates. You can extract SQL
2+
## template from staging/prod, but it's not clear if it's sufficiently
3+
## anonymized, so I'm not committing it without discussion.
4+
##
5+
## To fix this:
6+
## 1. Update the public "Bluebird-CRM.git" to have the current/reviewed templates.
7+
## 2. Update "download.sh". Remove references to this hack. (See "FIXME"s)
8+
## 3. Update "install.sh". Remove references to this hack. (See "FIXME"s)
9+
## 4. Update "install.sh". Load the real SQL files. (See "FIXME"s)
10+
## 5. Delete this file.
11+
12+
## For the moment, you have to download them manually before running civibuild.
13+
## This file prints an error with instructions.
14+
15+
manual_sql_files=(senate_test_c_template.sql senate_test_d_template.sql senate_test_l_template.sql)
16+
for SQL_FILE in "${manual_sql_files[@]}" ; do
17+
if [ ! -e "$SITE_CONFIG_DIR/sql/$SQL_FILE" ]; then
18+
echo >&2
19+
echo >&2 "FIXME: Bluebird-CRM.git does not have current SQL templates."
20+
echo >&2
21+
echo >&2 "Please manually create $SITE_CONFIG_DIR/sql/ with these files":
22+
for NEEDED in "${manual_sql_files[@]}" ; do
23+
echo >&2 " - $NEEDED"
24+
done
25+
echo >&2
26+
cvutil_fatal "FATAL: Bluebird requires manual override for SQL templates"
27+
fi
28+
done

app/config/bluebird/download.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
## "WEB_ROOT" here...)
1010

1111
###############################################################################
12+
## FIXME: Work-around incorrect SQL files
13+
source "$SITE_CONFIG_DIR/check-sql-override.sh"
14+
15+
###############################################################################
16+
## Main download
1217

1318
[ -z "$CMS_VERSION" ] && CMS_VERSION=dev
1419

@@ -23,8 +28,6 @@ git clone "$CACHE_DIR/nysenate/Bluebird-CRM.git" "$WEB_ROOT"
2328
pushd "$WEB_ROOT"
2429
git_checkout "$CMS_VERSION"
2530

26-
# FIXME: cp $HOME/Downloads/bluebird/senate_test_*sql templates/sql/
27-
2831
## Work-around: In buildkit-nix, Apache config has strong prefercence for "web/" folder.
2932
ln -sf drupal web
3033

app/config/bluebird/install.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
CMS_ROOT="$WEB_ROOT/web"
66

7+
###############################################################################
8+
## FIXME: Work-around incorrect SQL files
9+
source "$SITE_CONFIG_DIR/check-sql-override.sh"
10+
711
###############################################################################
812
## Helper functions
913

@@ -105,13 +109,13 @@ EOSQL
105109
## Populate databases
106110
(
107111
echo "CONNECT senate_c_$SITE_NAME;"
108-
#cat templates/sql/cividb_template.sql | fix_definer
109-
cat templates/sql/senate_test_c_template.sql | fix_definer
112+
## FIXME: cat templates/sql/cividb_template.sql | fix_definer
113+
cat "$SITE_CONFIG_DIR/sql/senate_test_c_template.sql" | fix_definer
110114
cat civicrm/custom/ext/gov.nysenate.dedupe/sql/shadow_func.sql
111115

112116
echo "CONNECT senate_d_$SITE_NAME;"
113-
#cat templates/sql/drupdb_template.sql | fix_definer
114-
cat templates/sql/senate_test_d_template.sql | fix_definer
117+
## FIXME: cat templates/sql/drupdb_template.sql | fix_definer
118+
cat "$SITE_CONFIG_DIR/sql/senate_test_d_template.sql" | fix_definer
115119

116120
## FIXME: Various work-arounds
117121
# echo 'update `system` set status = 0 where name like "%rules%";'
@@ -121,8 +125,8 @@ EOSQL
121125
echo "truncate cache_menu; truncate cache_page; truncate cache_path; truncate cache_rules; truncate cache_update;"
122126

123127
echo "CONNECT senate_l_$SITE_NAME;"
124-
#cat templates/sql/logdb_template.sql | fix_definer
125-
cat templates/sql/senate_test_l_template.sql | fix_definer
128+
## FIXME: cat templates/sql/logdb_template.sql | fix_definer
129+
cat "$SITE_CONFIG_DIR/sql/senate_test_l_template.sql" | fix_definer
126130

127131
## Override some settings via SQL.
128132
## FIXME: This could probably be done declaratively in civicrm.settings.php...
@@ -136,6 +140,7 @@ EOSQL
136140
./scripts/drush.sh "$SITE_NAME" -y upwd "$ADMIN_USER" --password="$ADMIN_PASS"
137141
## FIXME: ADMIN_EMAIL
138142
./scripts/drush.sh "$SITE_NAME" -y user-create --password="$DEMO_PASS" --mail="$DEMO_EMAIL" "$DEMO_USER"
143+
## FIXME: Grant some role to $DEMO_USER
139144

140145
chmod u+w drupal/sites/default/settings.php drupal/sites/default/civicrm.settings.php
141146
cvutil_inject_settings "drupal/sites/default/civicrm.settings.php" "civicrm.settings.d"

0 commit comments

Comments
 (0)