From 1d485ddb6826f2b3be65a9df5d8684ef699db46a Mon Sep 17 00:00:00 2001 From: James Troup Date: Thu, 25 Jan 2001 06:02:28 +0000 Subject: [PATCH] add override stuff to SQL files. --- add_constraints.sql | 24 +++++++++++++++++++++++- docs/.cvsignore | 1 + init_pool.sql | 27 +++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/add_constraints.sql b/add_constraints.sql index dd366c3a..b52b103b 100644 --- a/add_constraints.sql +++ b/add_constraints.sql @@ -1,4 +1,4 @@ --- Fix up after population off the database... +-- Fix up after population of the database... -- First of all readd the constraints (takes ~1:30 on auric) @@ -24,6 +24,12 @@ ALTER TABLE bin_associations ADD CONSTRAINT bin_associations_bin FOREIGN KEY (bi ALTER TABLE src_associations ADD CONSTRAINT src_associations_suite FOREIGN KEY (suite) REFERENCES suite(id) MATCH FULL; ALTER TABLE src_associations ADD CONSTRAINT src_associations_source FOREIGN KEY (source) REFERENCES source(id) MATCH FULL; +ALTER TABLE override ADD CONSTRAINT override_suite FOREIGN KEY (suite) REFERENCES suite(id) MATCH FULL; +ALTER TABLE override ADD CONSTRAINT override_component FOREIGN KEY (component) REFERENCES component(id) MATCH FULL; +ALTER TABLE override ADD CONSTRAINT override_priority FOREIGN KEY (priority) REFERENCES priority(id) MATCH FULL; +ALTER TABLE override ADD CONSTRAINT override_section FOREIGN KEY (section) REFERENCES section(id) MATCH FULL; +ALTER TABLE override ADD CONSTRAINT override_type FOREIGN KEY (type) REFERENCES override_type(id) MATCH FULL; + -- Then correct all the id SERIAL PRIMARY KEY columns... CREATE FUNCTION files_id_max() RETURNS INT4 @@ -44,6 +50,15 @@ CREATE FUNCTION binaries_id_max() RETURNS INT4 CREATE FUNCTION bin_associations_id_max() RETURNS INT4 AS 'SELECT max(id) FROM bin_associations' LANGUAGE 'sql'; +CREATE FUNCTION section_id_max() RETURNS INT4 + AS 'SELECT max(id) FROM section' + LANGUAGE 'sql'; +CREATE FUNCTION priority_id_max() RETURNS INT4 + AS 'SELECT max(id) FROM priority' + LANGUAGE 'sql'; +CREATE FUNCTION override_type_id_max() RETURNS INT4 + AS 'SELECT max(id) FROM override_type' + LANGUAGE 'sql'; SELECT setval('files_id_seq', files_id_max()); SELECT setval('source_id_seq', source_id_max()); @@ -51,6 +66,9 @@ SELECT setval('src_associations_id_seq', src_associations_id_max()); SELECT setval('dsc_files_id_seq', dsc_files_id_max()); SELECT setval('binaries_id_seq', binaries_id_max()); SELECT setval('bin_associations_id_seq', bin_associations_id_max()); +SELECT setval('section_id_seq', section_id_max()); +SELECT setval('priority_id_seq', priority_id_max()); +SELECT setval('override_type_id_seq', override_type_id_max()); -- Vacuum the tables for efficency @@ -67,6 +85,10 @@ VACUUM suite; VACUUM suite_architectures; VACUUM bin_associations; VACUUM src_associations; +VACUUM section; +VACUUM priority; +VACUUM override_type; +VACUUM override; -- FIXME: has to be a better way to do this GRANT ALL ON diff --git a/docs/.cvsignore b/docs/.cvsignore index a423dbea..151d0f8d 100644 --- a/docs/.cvsignore +++ b/docs/.cvsignore @@ -1 +1,2 @@ manpage.* +*.1 diff --git a/init_pool.sql b/init_pool.sql index 8da4a79f..5116f7e7 100644 --- a/init_pool.sql +++ b/init_pool.sql @@ -106,3 +106,30 @@ CREATE TABLE src_associations ( source INT4 NOT NULL, -- REFERENCES source unique (suite, source) ); + +CREATE TABLE section ( + id SERIAL PRIMARY KEY, + section TEXT UNIQUE NOT NULL +); + +CREATE TABLE priority ( + id SERIAL PRIMARY KEY, + priority TEXT UNIQUE NOT NULL, + level INT4 UNIQUE NOT NULL +); + +CREATE TABLE override_type ( + id SERIAL PRIMARY KEY, + type TEXT UNIQUE NOT NULL +); + +CREATE TABLE override ( + package TEXT NOT NULL, + suite INT4 NOT NULL, -- references suite + component INT4 NOT NULL, -- references component + priority INT4, -- references priority + section INT4 NOT NULL, -- references section + type INT4 NOT NULL, -- references override_type + maintainer TEXT, + unique (suite, component, package, type) +); -- GitLab