hpr-tools/PostgreSQL_Database/nuke_n_pave.sh
Dave Morriss 50edeccc88 Updates from previous repo
FAQ/FAQ.mkd, FAQ/Makefile: this version of the FAQ is now out of date
    and probably should be deleted.

InternetArchive/repair_item: script to upload missing shows after tie
    out errors during the normal upload; still under development.

InternetArchive/update_state: script to update show state in the
    'reservations' table in the database. Uses the CMS interface.

Link_Checker/scan_links: under development. Not currently usable.

Miscellaneous/fix_tags: audio metadata manipulation script. Recently
    added to this repo for convenience. Updates for 'experimental::try',
    the official Perl try/catch.

PostgreSQL_Database/add_hosts_to_show, PostgreSQL_Database/hpr_schema_2.pgsql,
    PostgreSQL_Database/nuke_n_pave.sh: an old experimental Pg database
    to take over from the previous MySQL version (from before 2023).
    Kept for reference; never implemented.
2024-06-14 16:00:04 +01:00

39 lines
823 B
Bash
Executable File

#!/bin/bash
#
# Script to re-initialise the HPR2 database then rebuild it from the local
# MySQL copy (and ia.db for the IA parts). Also updates shows with multiple
# hosts by adding the missing hosts.
#
#
# Check that the ensuing destruction is really meant!
#
echo "** Warning** This script will DELETE the PostgreSQL database 'HPR2'"
read -r -p "Are you sure? [y/N] " ans
if [[ -z $ans || ${ans^^} = 'N' ]]; then
echo "Aborting"
exit
fi
#
# Directories
#
BASEDIR="$HOME/HPR/PostgreSQL_Database"
cd "$BASEDIR" || { echo "Failed to cd to $BASEDIR"; exit 1; }
#
# Drops all tables, etc and re-creates them
#
psql -U hpradmin HPR2 < hpr_schema_2.pgsql
#
# Does all phases in order by default
#
./copy_mysql_pg_2 -verb
#
# Adds in all the double hosts we know about at the moment
#
./update_multi-host_shows.sh