-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcalibrate_db.sh
More file actions
executable file
·30 lines (28 loc) · 1.07 KB
/
calibrate_db.sh
File metadata and controls
executable file
·30 lines (28 loc) · 1.07 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
#!/bin/bash
# check if database exists. If so, do nothing, else calibrate.
service mysql restart && RESULT=`mysqlshow -u root -pdata thecourseforum_development| grep -v Wildcard | grep -o thecourseforum_development`
if [ "$RESULT" == "thecourseforum_development" ]; then
echo "Database already calibrated"
else
echo "Calibrating database"
chown -R mysql:mysql /var/lib/mysql /var/run/mysqld && service mysql restart
mysql -u root -pdata <<QUERY
drop database if exists thecourseforum_development;drop database if exists thecourseforum_production;
create database thecourseforum_development;
create database thecourseforum_production;
use thecourseforum_development;
source ./sql/thecourseforum_development.sql
use thecourseforum_production;
source ./sql/thecourseforum_production.sql;
QUERY
echo "Finished calibrating"
echo "Updating NPM"
npm install npm@latest -g
echo "Finished updating NPM"
echo "Updating packages"
yarn install
echo "Finished updating packages"
echo "Compiling webpacker"
bundle exec rake webpacker:compile
echo "Finished compiling webpacker"
fi