segler-alex / radiobrowser-api-rust

radio-browser API implementation in rust
GNU Affero General Public License v3.0
230 stars 96 forks source link

Unable to import the SQL dump #137

Closed raisen closed 11 months ago

raisen commented 2 years ago

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.

GHbasicuser commented 2 years ago

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}