Permalink
Browse files

Added, documented get_product_version_ids.

  • Loading branch information...
1 parent b1b398a commit f3a186e16b5e71a33f696e20f78c77ab922bec48 @jberkus jberkus committed Mar 20, 2012
@@ -60,7 +60,15 @@ get_product_version_ids
versions VARIADIC CITEXT
)
+ SELECT get_product_version_ids ( 'Firefox','11.0a1' );
+ SELECT get_product_version_ids ( 'Firefox','11.0a1','11.0a2','11.0b1');
+Takes a product name and a list of version_strings, and returns an array (list) of surrogate keys (product_version_ids) which can then be used in queries like:
+
+::
+
+ SELECT * FROM reports_clean WHERE date_processed BETWEEN '2012-03-21' AND '2012-03-38'
+ WHERE product_version_id = ANY ( $list );
View
@@ -0,0 +1,13 @@
+3.0 Database Updates
+====================
+
+This batch makes the following database changes:
+
+No Bug
+ Add function for middleware to retrieve lists of product_versions
+ from the DB.
+
+...
+
+The above changes should take only a few minutes to deploy.
+This upgrade does not require a downtime.
@@ -0,0 +1,16 @@
+\set ON_ERROR_STOP 1
+
+CREATE OR REPLACE FUNCTION get_product_version_ids (
+ product CITEXT,
+ VARIADIC versions CITEXT[]
+)
+returns INT[]
+language sql
+as $f$
+SELECT array_agg(product_version_id)
+FROM product_versions
+ WHERE product_name = $1
+ AND version_string = ANY ( $2 );
+$f$;
+
+
View
@@ -0,0 +1,23 @@
+#!/bin/bash
+#please see README
+
+set -e
+
+CURDIR=$(dirname $0)
+VERSION=3.0
+
+#echo '*********************************************************'
+#echo 'support functions'
+#psql -f ${CURDIR}/support_functions.sql breakpad
+
+echo '*********************************************************'
+echo 'add middleware function for retrieving lists of product-versions'
+echo 'no bug'
+psql -f ${CURDIR}/get_product_version_ids.sql breakpad
+
+#change version in DB
+psql -c "SELECT update_socorro_db_version( '$VERSION' )" breakpad
+
+echo "$VERSION upgrade done"
+
+exit 0

0 comments on commit f3a186e

Please sign in to comment.