]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/updatedb/update_postgresql_tables_7_to_8
- Fix altering PostgreSQL table to be compatible with version 7.3.
[bacula/bacula] / bacula / updatedb / update_postgresql_tables_7_to_8
index 84b2f0e3b398d4b3d9ea8603a79a9643a0668ad7..4c821ab6d60f32cb550475b2340c98eccee7fa2d 100755 (executable)
@@ -21,7 +21,11 @@ ALTER TABLE media ALTER COLUMN EndBlock SET NOT NULL;
 
 UPDATE Filename SET Name='' WHERE Name=' ';
 
-ALTER TABLE file ALTER COLUMN filenameid SET integer;
+alter table file alter column filenameid rename to filenameid-old;
+alter table file add column filenameid integer;
+update file set filenameid = filenameid-old;
+alter table file alter column filenameid set not null;
+alter table file drop column filenameid-old;
 
 DELETE FROM Version;
 INSERT INTO Version (VersionId) VALUES (8);
@@ -31,6 +35,15 @@ 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)
+);
+
+vacuum;
+
 END-OF-DATA
 then
    echo "Update of Bacula PostgreSQL tables succeeded."