Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 25 lines (18 sloc) 943 Bytes
#!/bin/bash -x
ROOT_DIR=$(cd $(dirname $0)/..; pwd)
DB_DIR="$ROOT_DIR/db"
BENCH_DIR="$ROOT_DIR/bench"
export MYSQL_PWD=isucon
mysql -uisucon -e "DROP DATABASE IF EXISTS torb; CREATE DATABASE torb;"
mysql -uisucon torb < "$DB_DIR/schema.sql"
if [ ! -f "$DB_DIR/isucon8q-initial-dataset.sql.gz" ]; then
echo "Run the following command beforehand." 1>&2
echo "$ ( cd \"$BENCH_DIR\" && bin/gen-initial-dataset )" 1>&2
exit 1
fi
mysql -uisucon torb -e 'ALTER TABLE reservations DROP KEY event_id_and_sheet_id_idx'
gzip -dc "$DB_DIR/isucon8q-initial-dataset.sql.gz" | mysql -uisucon torb
mysql -uisucon torb -e 'ALTER TABLE reservations ADD KEY event_id_and_sheet_id_idx (event_id, sheet_id)'
mysql -uisucon torb -e'alter table reservations add index user_id(user_id)'
mysql -uisucon torb -e'alter table reservations add index canceled_at(canceled_at)'
mysql -uisucon torb -e'alter table reservations add index reserved_at(reserved_at)'