From 9286c3a0d38dc797564368a32c9ba8d2c2afe7e4 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Wed, 13 Nov 2013 09:15:46 -0800 Subject: [PATCH] allow for duplicate, disabled src packages --- Debbugs/DB/Result/SrcPkg.pm | 69 ++++++++++++++++++++++++++++++++++--- sql/debbugs_schema.sql | 11 ++++-- 2 files changed, 74 insertions(+), 6 deletions(-) diff --git a/Debbugs/DB/Result/SrcPkg.pm b/Debbugs/DB/Result/SrcPkg.pm index a76b3f5..cf45e3b 100644 --- a/Debbugs/DB/Result/SrcPkg.pm +++ b/Debbugs/DB/Result/SrcPkg.pm @@ -65,6 +65,31 @@ Source package name Source package id which this source package is an alias of +=head2 creation + + data_type: 'timestamp with time zone' + default_value: current_timestamp + is_nullable: 1 + original: {default_value => \"now()"} + +=head2 disabled + + data_type: 'timestamp with time zone' + is_nullable: 1 + +=head2 last_modified + + data_type: 'timestamp with time zone' + default_value: current_timestamp + is_nullable: 1 + original: {default_value => \"now()"} + +=head2 obsolete + + data_type: 'boolean' + default_value: false + is_nullable: 1 + =cut __PACKAGE__->add_columns( @@ -81,6 +106,24 @@ __PACKAGE__->add_columns( { data_type => "boolean", default_value => \"false", is_nullable => 1 }, "alias_of", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "creation", + { + data_type => "timestamp with time zone", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "disabled", + { data_type => "timestamp with time zone", is_nullable => 1 }, + "last_modified", + { + data_type => "timestamp with time zone", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "obsolete", + { data_type => "boolean", default_value => \"false", is_nullable => 1 }, ); =head1 PRIMARY KEY @@ -97,17 +140,35 @@ __PACKAGE__->set_primary_key("id"); =head1 UNIQUE CONSTRAINTS -=head2 C +=head2 C + +=over 4 + +=item * L + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("src_pkg_pkg_alias", ["pkg", "alias_of", "obsolete"]); + +=head2 C =over 4 =item * L +=item * L + =back =cut -__PACKAGE__->add_unique_constraint("src_pkg_pkg_key", ["pkg"]); +__PACKAGE__->add_unique_constraint("src_pkg_pkg_disabled", ["pkg", "disabled"]); =head1 RELATIONS @@ -192,8 +253,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-10-09 20:27:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JYP+MBnjgk3I/XtRNh2UyA +# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-13 09:14:52 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3Jq0yBnJv5OW6jfXwUPUBg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/sql/debbugs_schema.sql b/sql/debbugs_schema.sql index 36adc81..71a470d 100644 --- a/sql/debbugs_schema.sql +++ b/sql/debbugs_schema.sql @@ -158,11 +158,18 @@ INSERT INTO column_comments VALUES ('bug_merged','merged','Bug number which is m CREATE TABLE src_pkg ( id SERIAL PRIMARY KEY, - pkg TEXT NOT NULL UNIQUE, + pkg TEXT NOT NULL, pseduopkg BOOLEAN DEFAULT FALSE, - alias_of INT REFERENCES src_pkg ON UPDATE CASCADE ON DELETE CASCADE + alias_of INT REFERENCES src_pkg ON UPDATE CASCADE ON DELETE CASCADE, + creation TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + disabled TIMESTAMP WITH TIME ZONE DEFAULT NULL, + last_modified TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + obsolete BOOLEAN DEFAULT FALSE, CONSTRAINT src_pkg_doesnt_alias_itself CHECK (id <> alias_of) ); +CREATE UNIQUE INDEX src_pkg_pkg_alias ON src_pkg(pkg,alias_of,obsolete); +CREATE INDEX src_pkg_pkg ON src_pkg(pkg); +CREATE UNIQUE INDEX src_pkg_pkg_disabled ON src_pkg(pkg,disabled); INSERT INTO table_comments VALUES ('src_pkg','Source packages'); INSERT INTO column_comments VALUES ('src_pkg','id','Source package id'); INSERT INTO column_comments VALUES ('src_pkg','pkg','Source package name'); -- 2.39.2