segler-alex/radiobrowser-api-rust

Unable to import the SQL dump

raisen opened this issue · 1 comments

Steps to reproduce:

wget https://backups.radio-browser.info/latest.sql.gz
gunzip latest.sql.gz
docker run -i --rm -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=radio -v $(pwd)/latest.sql:/docker-entrypoint-initdb.d/latest.sql -p 3306:3306 mysql

mysql server error I'm receiving:
ERROR 1146 (42S02) at line 606: Table 'radio.StationCheckHistory' doesn't exist

Line 606 at the time when this issue was opened is:

/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`radiouser`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `StationCheck` AS select `StationCheckHistory`
(truncated)

It looks like the view is being created before the table StationCheckHistory.

Removing the SQL statements to create the view fixed the issue and database was initialized correctly.

Hi

If anyone could fix the backup.sh file that would be great. (https://github.com/segler-alex/radiobrowser-api-rust/blob/master/deployment/backup.sh)

Maybe by modifying it in this way ? 😐

mysqldump ${DBNAME} --ignore-table=${DBNAME}.StationCheck --ignore-table=${DBNAME}.StationCheckHistory  --ignore-table=${DBNAME}.StationClick > ${NAME}
mysqldump --no-data ${DBNAME} StationCheckHistory StationClick >> ${NAME}
mysqldump ${DBNAME} StationCheck >> ${NAME}