VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testmanager/db/tmdb-r01-builds-1.pgsql@ 82972

Last change on this file since 82972 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1-- $Id: tmdb-r01-builds-1.pgsql 82968 2020-02-04 10:35:17Z vboxsync $
2--- @file
3-- VBox Test Manager Database - Changed Builds to be historized.
4--
5
6--
7-- Copyright (C) 2012-2020 Oracle Corporation
8--
9-- This file is part of VirtualBox Open Source Edition (OSE), as
10-- available from http://www.virtualbox.org. This file is free software;
11-- you can redistribute it and/or modify it under the terms of the GNU
12-- General Public License (GPL) as published by the Free Software
13-- Foundation, in version 2 as it comes in the "COPYING" file of the
14-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16--
17-- The contents of this file may alternatively be used under the terms
18-- of the Common Development and Distribution License Version 1.0
19-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20-- VirtualBox OSE distribution, in which case the provisions of the
21-- CDDL are applicable instead of those of the GPL.
22--
23-- You may elect to license modified versions of this file under the
24-- terms and conditions of either the GPL or the CDDL or both.
25--
26
27
28DROP TABLE OldBuilds;
29DROP TABLE NewBuilds;
30DROP INDEX BuildsLookupIdx;
31
32\set ON_ERROR_STOP 1
33
34--
35-- idBuild won't be unique, so it cannot be used directly as a foreign key
36-- by TestSets.
37--
38ALTER TABLE TestSets
39 DROP CONSTRAINT TestSets_idBuild_fkey;
40ALTER TABLE TestSets
41 DROP CONSTRAINT TestSets_idBuildTestSuite_fkey;
42
43
44--
45-- Create the table, filling it with the current Builds content.
46--
47CREATE TABLE NewBuilds (
48 idBuild INTEGER DEFAULT NEXTVAL('BuildIdSeq') NOT NULL,
49 tsCreated TIMESTAMP WITH TIME ZONE DEFAULT current_timestamp NOT NULL,
50 tsEffective TIMESTAMP WITH TIME ZONE DEFAULT current_timestamp NOT NULL,
51 tsExpire TIMESTAMP WITH TIME ZONE DEFAULT TIMESTAMP WITH TIME ZONE 'infinity' NOT NULL,
52 uidAuthor INTEGER DEFAULT NULL,
53 idBuildCategory INTEGER REFERENCES BuildCategories(idBuildCategory) NOT NULL,
54 iRevision INTEGER NOT NULL,
55 sVersion TEXT NOT NULL,
56 sLogUrl TEXT,
57 sBinaries TEXT NOT NULL,
58 fBinariesDeleted BOOLEAN DEFAULT FALSE NOT NULL,
59 UNIQUE (idBuild, tsExpire)
60);
61
62INSERT INTO NewBuilds (idBuild, tsCreated, tsEffective, uidAuthor, idBuildCategory, iRevision, sVersion, sLogUrl, sBinaries)
63 SELECT idBuild, tsCreated, tsCreated, uidAuthor, idBuildCategory, iRevision, sVersion, sLogUrl, sBinaries
64 FROM Builds;
65COMMIT;
66
67-- Switch the tables.
68ALTER TABLE Builds RENAME TO OldBuilds;
69ALTER TABLE NewBuilds RENAME TO Builds;
70COMMIT;
71
72-- Finally index the table.
73CREATE INDEX BuildsLookupIdx ON Builds (idBuildCategory, iRevision);
74COMMIT;
75
76DROP TABLE OldBuilds;
77COMMIT;
78
79-- Fix implicit index name.
80ALTER INDEX newbuilds_idbuild_tsexpire_key RENAME TO builds_idbuild_tsexpire_key;
81
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette