]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/update_mysql_tables.in
ebl Fix the mysql creation script that double-created an
[bacula/bacula] / bacula / src / cats / update_mysql_tables.in
1 #!/bin/sh
2 #
3 # Shell script to update MySQL tables from version 2.0 to 3.0   
4 #
5 echo " "
6 echo "This script will update a Bacula MySQL database from version 10 to 11"
7 echo " which is needed to convert from Bacula version 2.0.x to 3.0.x or higher"
8 echo " "
9 bindir=@SQL_BINDIR@
10 db_name=@db_name@
11
12 if $bindir/mysql $* -f <<END-OF-DATA
13 USE ${db_name};
14
15 -- Create a table like Job for long term statistics
16 CREATE TABLE JobStat (LIKE Job);
17
18 -- Fix bad index on Media table
19 DROP INDEX inx8;
20 CREATE UNIQUE INDEX inx8 ON Media (VolumeName(128));
21
22 DELETE FROM Version;
23 INSERT INTO Version (VersionId) VALUES (11);
24
25 END-OF-DATA
26 then
27    echo "Update of Bacula MySQL tables succeeded."
28 else
29    echo "Update of Bacula MySQL tables failed."
30 fi
31 exit 0