diff --git a/alembic/versions/2cbb29fc9b77_bug_880378_make_upda.py b/alembic/versions/2cbb29fc9b77_bug_880378_make_upda.py new file mode 100644 index 0000000000..68f7f29312 --- /dev/null +++ b/alembic/versions/2cbb29fc9b77_bug_880378_make_upda.py @@ -0,0 +1,32 @@ +"""bug 880378 make update_adu throw exceptions + +Revision ID: 2cbb29fc9b77 +Revises: 2b285e76f71d +Create Date: 2013-06-28 15:09:38.750774 + +""" + +# revision identifiers, used by Alembic. +revision = '2cbb29fc9b77' +down_revision = '4d4b48f86d4b' + +import os +import sqlalchemy as sa +from alembic import op +from sqlalchemy.dialects import postgresql +from sqlalchemy import types +from sqlalchemy.sql import table, column + +def upgrade(): + app_path=os.getcwd() + procs = [ + 'update_adu.sql' + , 'update_build_adu.sql' + ] + for myfile in [app_path + '/socorro/external/postgresql/raw_sql/procs/' + line for line in procs]: + with open(myfile, 'r') as file: + op.execute(file.read()) + +def downgrade(): + # No automated backout + pass diff --git a/socorro/external/postgresql/raw_sql/procs/update_adu.sql b/socorro/external/postgresql/raw_sql/procs/update_adu.sql index 4881cc8ea7..8676c14428 100644 --- a/socorro/external/postgresql/raw_sql/procs/update_adu.sql +++ b/socorro/external/postgresql/raw_sql/procs/update_adu.sql @@ -12,11 +12,8 @@ PERFORM 1 FROM raw_adu WHERE "date" = updateday LIMIT 1; -IF NOT FOUND and checkdata THEN - RAISE NOTICE 'raw_adu not updated for %', updateday; - RETURN FALSE; -ELSIF NOT FOUND THEN - RETURN FALSE; +IF NOT FOUND THEN + RAISE EXCEPTION 'raw_adu not updated for %', updateday; END IF; -- check if ADU has already been run for the date diff --git a/socorro/external/postgresql/raw_sql/procs/update_build_adu.sql b/socorro/external/postgresql/raw_sql/procs/update_build_adu.sql index a1e9ee3162..6c0f8512f3 100644 --- a/socorro/external/postgresql/raw_sql/procs/update_build_adu.sql +++ b/socorro/external/postgresql/raw_sql/procs/update_build_adu.sql @@ -23,12 +23,7 @@ PERFORM 1 FROM raw_adu WHERE "date" = updateday LIMIT 1; IF NOT FOUND THEN - IF checkdata THEN - RAISE NOTICE 'raw_adu has not been updated for %',updateday; - RETURN FALSE; - ELSE - RETURN FALSE; - END IF; + RAISE EXCEPTION 'raw_adu has not been updated for %',updateday; END IF; -- insert nightly, aurora