cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johnth...@apache.org
Subject svn commit: r1425410 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java
Date Sun, 23 Dec 2012 05:25:51 GMT
Author: johnthuss
Date: Sun Dec 23 05:25:51 2012
New Revision: 1425410

URL: http://svn.apache.org/viewvc?rev=1425410&view=rev
Log:
Add 'IF NOT EXISTS' to 'CREATE TABLE AUTO_PK_SUPPORT' to support migrations

The 'IF NOT EXISTS' clause is supported in MySQL all the way back to at
least 3.2 (now at 5.5).

Adding this will enable migrations to create tables without failing
because it tries to create the AUTO_PK_SUPPORT table every time.

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java?rev=1425410&r1=1425409&r2=1425410&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/mysql/MySQLPkGenerator.java
Sun Dec 23 05:25:51 2012
@@ -144,7 +144,7 @@ public class MySQLPkGenerator extends Jd
     @Override
     protected String pkTableCreateString() {
         StringBuilder buf = new StringBuilder();
-        buf.append("CREATE TABLE AUTO_PK_SUPPORT (").append(
+        buf.append("CREATE TABLE IF NOT EXISTS AUTO_PK_SUPPORT (").append(
                 "  TABLE_NAME CHAR(100) NOT NULL,").append(
                 "  NEXT_ID BIGINT NOT NULL, UNIQUE (TABLE_NAME)").append(")");
 



Mime
View raw message