From df66b48237e4aee7b4a4c612dc74c306766246a3 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 3 Sep 2017 10:40:00 +0200 Subject: [PATCH] Fix SQLite3 Version bug #2305 --- bacula/src/cats/make_sqlite3_tables.in | 25 ++++++++++++------------ bacula/src/cats/update_sqlite3_tables.in | 9 +++++++++ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/bacula/src/cats/make_sqlite3_tables.in b/bacula/src/cats/make_sqlite3_tables.in index 507adaf4b3..e2ea2433f4 100644 --- a/bacula/src/cats/make_sqlite3_tables.in +++ b/bacula/src/cats/make_sqlite3_tables.in @@ -175,6 +175,8 @@ CREATE TABLE FileSet ( PRIMARY KEY(FileSetId) ); +CREATE INDEX fileset_name_idx on FileSet (FileSet); + CREATE TABLE JobMedia ( JobMediaId INTEGER, JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, @@ -246,6 +248,7 @@ CREATE TABLE Media ( PRIMARY KEY(MediaId) ); +CREATE UNIQUE INDEX Media_Volumename_Id ON Media (VolumeName); CREATE INDEX inx8 ON Media (PoolId); CREATE INDEX inx9 ON Media (StorageId); @@ -315,6 +318,7 @@ CREATE TABLE Pool ( PRIMARY KEY (PoolId) ); +CREATE INDEX pool_name_idx on Pool (Name); CREATE TABLE Client ( ClientId INTEGER, @@ -327,6 +331,8 @@ CREATE TABLE Client ( PRIMARY KEY(ClientId) ); +CREATE UNIQUE INDEX client_name_idx on Client (Name); + CREATE TABLE BaseFiles ( BaseId BIGINT, BaseJobId INTEGER UNSIGNED REFERENCES Job NOT NULL, @@ -347,17 +353,6 @@ CREATE TABLE UnsavedFiles ( ); -CREATE TABLE NextId ( - id INTEGER UNSIGNED DEFAULT 0, - TableName TEXT NOT NULL, - PRIMARY KEY (TableName) - ); - - - --- Initialize JobId to start at 1 -INSERT INTO NextId (id, TableName) VALUES (1, 'Job'); - CREATE TABLE Version ( VersionId INTEGER UNSIGNED NOT NULL ); @@ -472,12 +467,18 @@ INSERT INTO Status (JobStatus,JobStatusLong,Severity) VALUES ('I', 'Incomplete Job',25); -- Initialize Version -INSERT INTO Version (VersionId) VALUES (15); +INSERT INTO Version (VersionId) VALUES (16); PRAGMA default_cache_size = 100000; PRAGMA synchronous = NORMAL; END-OF-DATA +echo "" +echo "WARNING: !!!! SQLite3 is no longer supported. !!!!" +echo "WARNING: !!!! Please switch to MySQL or PostgreSQL !!!!" +echo "WARNING: !!!! as soon as possible. !!!!" +echo "" + chmod 640 ${db_name}.db exit 0 diff --git a/bacula/src/cats/update_sqlite3_tables.in b/bacula/src/cats/update_sqlite3_tables.in index 7595a2f56d..6085ce8298 100644 --- a/bacula/src/cats/update_sqlite3_tables.in +++ b/bacula/src/cats/update_sqlite3_tables.in @@ -199,5 +199,14 @@ fi COMMIT; END-OF-DATA + +echo "" + +echo "WARNING: !!!! SQLite3 is no longer supported. !!!!" +echo "WARNING: !!!! Please switch to MySQL or PostgreSQL !!!!" +echo "WARNING: !!!! as soon as possible. !!!!" +echo "" + + DBVERSION=16 fi -- 2.39.5