From: Holger Levsen Date: Wed, 26 Sep 2012 16:29:06 +0000 (+0200) Subject: database changes are hard. thats why we do them now. X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=7811243603960b6b3f54e7a594b8b3dc8fdf19ff;p=profitbricks%2Fjenkins-build-scripts.git database changes are hard. thats why we do them now. --- diff --git a/debian_build.py b/debian_build.py index 168ff5b..72bcb76 100755 --- a/debian_build.py +++ b/debian_build.py @@ -161,15 +161,15 @@ def db_add_package(con, package): #logger.debug("INSERT INTO deb_package(name) VALUES('%s') RETURNING id" % (package)) return cur.fetchone()[0] -def db_add_package_instance(con, package_id, origin_id, build_id, version): +def db_add_package_instance(con, package_id, origin_id, build_result_id, version): cur = con.cursor() cur.execute("SAVEPOINT a") try: - cur.execute("INSERT INTO deb_package_instance(deb_package_id, deb_package_origin_id, jenkins_build_id, version, available) VALUES(%s, %s, %s, '%s', 'true') RETURNING id" % (package_id, origin_id, build_id, version)) + cur.execute("INSERT INTO deb_package_instance(deb_package_id, deb_package_origin_id, jenkins_build_result_id, version, available) VALUES(%s, %s, %s, '%s', 'true') RETURNING id" % (package_id, origin_id, build_result_id, version)) except psycopg2.DatabaseError as e: # record already exist - this MUST NOT HAPPEN cur.execute("ROLLBACK TO a") # have to rollback after failed command - logger_error("FAILED: INSERT INTO deb_package_instance(deb_package_id, deb_package_origin_id, jenkins_build_id, version, available) VALUES(%s, %s, %s, '%s', 'true') RETURNING id" % (package_id, origin_id, build_id, version)) + logger_error("FAILED: INSERT INTO deb_package_instance(deb_package_id, deb_package_origin_id, jenkins_build_result_id, version, available) VALUES(%s, %s, %s, '%s', 'true') RETURNING id" % (package_id, origin_id, build_result_id, version)) exit_error() return cur.fetchone()[0]