Revision: b184a23805f3 Author: Andrew Lindesay <apl@xxxxxxxxxxxxxx> Date: Sat Jun 7 10:11:36 2014 UTCLog: + split the database migration into two parts to avoid a postgres issue with mixed DML and DDL.
http://code.google.com/p/haiku-depot-web-app/source/detail?r=b184a23805f3 Added:/haikudepotserver-webapp/src/main/resources/db/haikudepot/migration/V1.9__Pkg_Derived_Rating_2.sql
Modified:/haikudepotserver-webapp/src/main/resources/db/haikudepot/migration/V1.8__Pkg_Derived_Rating.sql /haikudepotserver-webapp/src/test/java/org/haikuos/haikudepotserver/IntegrationTestSupportService.java
======================================= --- /dev/null+++ /haikudepotserver-webapp/src/main/resources/db/haikudepot/migration/V1.9__Pkg_Derived_Rating_2.sql Sat Jun 7 10:11:36 2014 UTC
@@ -0,0 +1,9 @@ +-- ------------------------------------------------------ +-- STORE A DERIVED USER RATING ON THE PACKAGE +-- ------------------------------------------------------ + +-- had to be split into a separate migration to get into a different +-- transaction or else it causes; +-- ERROR: cannot ALTER TABLE "pkg" because it has pending trigger events ++ALTER TABLE haikudepot.pkg ALTER COLUMN derived_rating_sample_size SET NOT NULL;
=======================================--- /haikudepotserver-webapp/src/main/resources/db/haikudepot/migration/V1.8__Pkg_Derived_Rating.sql Wed Jun 4 11:36:29 2014 UTC +++ /haikudepotserver-webapp/src/main/resources/db/haikudepot/migration/V1.8__Pkg_Derived_Rating.sql Sat Jun 7 10:11:36 2014 UTC
@@ -5,5 +5,4 @@ ALTER TABLE haikudepot.pkg ADD COLUMN derived_rating FLOAT; ALTER TABLE haikudepot.pkg ADD COLUMN derived_rating_sample_size INT4; UPDATE haikudepot.pkg SET derived_rating_sample_size = 0;-ALTER TABLE haikudepot.pkg ALTER COLUMN derived_rating_sample_size SET NOT NULL;
=======================================--- /haikudepotserver-webapp/src/test/java/org/haikuos/haikudepotserver/IntegrationTestSupportService.java Mon May 5 12:10:19 2014 UTC +++ /haikudepotserver-webapp/src/test/java/org/haikuos/haikudepotserver/IntegrationTestSupportService.java Sat Jun 7 10:11:36 2014 UTC
@@ -131,6 +131,8 @@ result.pkg1 = context.newObject(Pkg.class); result.pkg1.setActive(true); result.pkg1.setName("pkg1"); + result.pkg1.setDerivedRating(3.5f); + result.pkg1.setDerivedRatingSampleSize(4); {PkgPkgCategory pkgPkgCategory = context.newObject(PkgPkgCategory.class);