#!/bin/sh # Five character slots: player_index.pid5. Idempotent. # sh install.sh e.g. sh install.sh player_sb # Install before starting a db/game built with ENABLE_PLAYER_PER_ACCOUNT5 (its login queries select pid5). set -e DB=${1:?player db} HERE=$(cd "$(dirname "$0")" && pwd) HAS=$(mysql -uroot -N "$DB" -e "SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='$DB' AND TABLE_NAME='player_index' AND COLUMN_NAME='pid5'") [ "$HAS" = 0 ] && mysql -uroot "$DB" < "$HERE/schema.sql" mysql -uroot "$DB" -e "SHOW COLUMNS FROM player_index LIKE 'pid%'"