From f0852a412757074e8c493da4c24677da325da935 Mon Sep 17 00:00:00 2001 From: Scott Barninger Date: Sat, 16 Oct 2004 11:30:39 +0000 Subject: [PATCH] Update database scripts to include CDImages table for bimagemgr. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1652 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/cats/make_mysql_tables.in | 6 ++++++ bacula/src/cats/make_postgresql_tables.in | 7 +++++++ bacula/src/cats/make_sqlite_tables.in | 7 +++++++ bacula/src/cats/update_mysql_tables.in | 6 ++++++ bacula/src/cats/update_postgresql_tables.in | 7 +++++++ bacula/src/cats/update_sqlite_tables.in | 6 ++++++ bacula/src/cats/update_sqlite_tables.in.patch | 2 +- bacula/updatedb/update_mysql_tables_7_to_8 | 6 ++++++ bacula/updatedb/update_postgresql_tables_7_to_8 | 7 +++++++ bacula/updatedb/update_sqlite_tables_7_to_8 | 6 ++++++ 10 files changed, 59 insertions(+), 1 deletion(-) diff --git a/bacula/src/cats/make_mysql_tables.in b/bacula/src/cats/make_mysql_tables.in index e5da834bbb..2834d345c3 100644 --- a/bacula/src/cats/make_mysql_tables.in +++ b/bacula/src/cats/make_mysql_tables.in @@ -195,6 +195,12 @@ CREATE TABLE Counters ( PRIMARY KEY (Counter(128)) ); +CREATE TABLE CDImages ( + MediaId INTEGER UNSIGNED NOT NULL, + LastBurn DATETIME NOT NULL, + PRIMARY KEY (MediaId) + ); + END-OF-DATA then diff --git a/bacula/src/cats/make_postgresql_tables.in b/bacula/src/cats/make_postgresql_tables.in index ae642022e2..2f997484ef 100644 --- a/bacula/src/cats/make_postgresql_tables.in +++ b/bacula/src/cats/make_postgresql_tables.in @@ -258,6 +258,13 @@ create table unsavedfiles primary key (UnsavedId) ); +create table CDImages +( + MediaId integer not null, + LastBurn timestamp without time zone not null, + primary key (MediaId) +); + -- Make sure we have appropriate permissions diff --git a/bacula/src/cats/make_sqlite_tables.in b/bacula/src/cats/make_sqlite_tables.in index cc2acf219c..7102e196ae 100644 --- a/bacula/src/cats/make_sqlite_tables.in +++ b/bacula/src/cats/make_sqlite_tables.in @@ -206,6 +206,13 @@ CREATE TABLE Counters ( PRIMARY KEY (Counter) ); +CREATE TABLE CDImages ( + MediaId INTEGER UNSIGNED NOT NULL, + LastBurn DATETIME NOT NULL, + PRIMARY KEY (MediaId) + ); + + PRAGMA default_synchronous = OFF; PRAGMA default_cache_size = 10000; diff --git a/bacula/src/cats/update_mysql_tables.in b/bacula/src/cats/update_mysql_tables.in index 5adc8f50fa..64797d65f2 100755 --- a/bacula/src/cats/update_mysql_tables.in +++ b/bacula/src/cats/update_mysql_tables.in @@ -19,6 +19,12 @@ ALTER TABLE File ADD INDEX (JobId, PathId, FilenameId); UPDATE Filename SET Name='' WHERE Name=' '; +CREATE TABLE CDImages ( + MediaId INTEGER UNSIGNED NOT NULL, + LastBurn DATETIME NOT NULL, + PRIMARY KEY (MediaId) + ); + DELETE FROM Version; INSERT INTO Version (VersionId) VALUES (8); diff --git a/bacula/src/cats/update_postgresql_tables.in b/bacula/src/cats/update_postgresql_tables.in index c3fe199811..873e063b3c 100755 --- a/bacula/src/cats/update_postgresql_tables.in +++ b/bacula/src/cats/update_postgresql_tables.in @@ -31,6 +31,13 @@ create index file_pathid_idx on file(pathid); create index file_filenameid_idx on file(filenameid); create index file_jpfid_idx on file (jobid, pathid, filenameid); +create table CDImages +( + MediaId integer not null, + LastBurn timestamp without time zone not null, + primary key (MediaId) +); + END-OF-DATA then echo "Update of Bacula PostgreSQL tables succeeded." diff --git a/bacula/src/cats/update_sqlite_tables.in b/bacula/src/cats/update_sqlite_tables.in index 7d3610b061..1a507be38a 100755 --- a/bacula/src/cats/update_sqlite_tables.in +++ b/bacula/src/cats/update_sqlite_tables.in @@ -109,6 +109,12 @@ INSERT INTO Media ( DROP TABLE Media_backup; +CREATE TABLE CDImages ( + MediaId INTEGER UNSIGNED NOT NULL, + LastBurn DATETIME NOT NULL, + PRIMARY KEY (MediaId) + ); + CREATE INDEX inx9 ON File (JobId, PathId, FileNameId); COMMIT; diff --git a/bacula/src/cats/update_sqlite_tables.in.patch b/bacula/src/cats/update_sqlite_tables.in.patch index 614cf29f41..7dba46c15e 100644 --- a/bacula/src/cats/update_sqlite_tables.in.patch +++ b/bacula/src/cats/update_sqlite_tables.in.patch @@ -1,4 +1,4 @@ -10c10 +11c11 < bindir=@SQL_BINDIR@ --- > bindir=/usr/lib/sqlite diff --git a/bacula/updatedb/update_mysql_tables_7_to_8 b/bacula/updatedb/update_mysql_tables_7_to_8 index d1a346c385..58a50eff9f 100755 --- a/bacula/updatedb/update_mysql_tables_7_to_8 +++ b/bacula/updatedb/update_mysql_tables_7_to_8 @@ -20,6 +20,12 @@ UPDATE Filename SET Name='' WHERE Name=' '; DELETE FROM Version; INSERT INTO Version (VersionId) VALUES (8); +CREATE TABLE CDImages ( + MediaId INTEGER UNSIGNED NOT NULL, + LastBurn DATETIME NOT NULL, + PRIMARY KEY (MediaId) + ); + END-OF-DATA then echo "Update of Bacula MySQL tables succeeded." diff --git a/bacula/updatedb/update_postgresql_tables_7_to_8 b/bacula/updatedb/update_postgresql_tables_7_to_8 index d654f6014b..b2dd8e60a2 100755 --- a/bacula/updatedb/update_postgresql_tables_7_to_8 +++ b/bacula/updatedb/update_postgresql_tables_7_to_8 @@ -20,6 +20,13 @@ UPDATE Filename SET Name='' WHERE Name=' '; DELETE FROM Version; INSERT INTO Version (VersionId) VALUES (8); +create table CDImages +( + MediaId integer not null, + LastBurn timestamp without time zone not null, + primary key (MediaId) +); + END-OF-DATA then echo "Update of Bacula PostgreSQL tables succeeded." diff --git a/bacula/updatedb/update_sqlite_tables_7_to_8 b/bacula/updatedb/update_sqlite_tables_7_to_8 index f0a33a1663..d7e1f83f9d 100755 --- a/bacula/updatedb/update_sqlite_tables_7_to_8 +++ b/bacula/updatedb/update_sqlite_tables_7_to_8 @@ -109,6 +109,12 @@ INSERT INTO Media ( DROP TABLE Media_backup; +CREATE TABLE CDImages ( + MediaId INTEGER UNSIGNED NOT NULL, + LastBurn DATETIME NOT NULL, + PRIMARY KEY (MediaId) + ); + COMMIT; UPDATE Filename SET Name='' WHERE Name=' '; -- 2.39.5