X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FDB%2FResult%2FSrcVer.pm;h=4181c1ed49757cc9f2ba2bc432aa5d8a57e6352b;hb=37356e95886969d5a5a5609f3e2fc95226e05cc5;hp=79c39f182c95ea78b9e6ebf0d990010b6714b48a;hpb=773c964cfcf6ac6ce095ba46b98455b6e4be5e7b;p=debbugs.git diff --git a/Debbugs/DB/Result/SrcVer.pm b/Debbugs/DB/Result/SrcVer.pm index 79c39f1..4181c1e 100644 --- a/Debbugs/DB/Result/SrcVer.pm +++ b/Debbugs/DB/Result/SrcVer.pm @@ -263,5 +263,23 @@ __PACKAGE__->has_many( # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gY5LidUaQeuJ5AnN06CfKQ +sub sqlt_deploy_hook { + my ($self, $sqlt_table) = @_; + $sqlt_table->schema-> + add_procedure(name => 'src_ver_to_src_pkg', + sql => <<'EOF', +CREATE OR REPLACE FUNCTION src_ver_to_src_pkg(src_ver INT) RETURNS INT + AS $src_ver_to_src_pkg$ + DECLARE + src_pkg int; + BEGIN + SELECT sv.src_pkg INTO STRICT src_pkg + FROM src_ver sv WHERE sv.id=src_ver; + RETURN src_pkg; + END + $src_ver_to_src_pkg$ LANGUAGE plpgsql; +EOF + ); +} # You can replace this text with custom code or comments, and it will be preserved on regeneration 1;