You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by mw...@apache.org on 2026/10/13 09:51:50 UTC

svn commit: r1939087 - in db/torque/trunk/torque-templates/src: main/resources/org/apache/torque/templates/sql/templates/ddl/mysql test/resources/org/apache/torque/templates test/schema

Author: mwriedt
Date: Tue Oct 13 09:51:50 2026
New Revision: 1939087

Log:
Fix MySQL table options: render all, not only first

Modified:
   db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/tableCreateOptions.groovy
   db/torque/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema-mysql.sql
   db/torque/trunk/torque-templates/src/test/schema/schema.xml

Modified: db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/tableCreateOptions.groovy
==============================================================================
--- db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/tableCreateOptions.groovy	Tue Oct 13 09:35:07 2026	(r1939086)
+++ db/torque/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/tableCreateOptions.groovy	Tue Oct 13 09:51:50 2026	(r1939087)
@@ -22,6 +22,7 @@
 // Creates the options for table creation.
 //
 org.apache.torque.templates.model.Table table = torqueGen.model
+def result = ""
 for (org.apache.torque.templates.model.Option option : table.optionList)
 {
   if (option.key == "ENGINE" 
@@ -33,6 +34,7 @@ for (org.apache.torque.templates.model.O
         || option.key == "CONNECTION"
         || option.key == "DATA DIRECTORY"
         || option.key == "DEFAULT CHARACTER SET"
+        || option.key == "DEFAULT CHARSET"
         || option.key == "DEFAULT COLLATE"
         || option.key == "DELAY_KEY_WRITE"
         || option.key == "ENGINE"
@@ -47,10 +49,11 @@ for (org.apache.torque.templates.model.O
         || option.key == "TABLESPACE"
         || option.key == "UNION") 
   {
-    return " $option.key=$option.value"
+    result += " $option.key=$option.value"
   }
   else if (option.key == "PARTITION BY") 
   { 
-    return " $option.key $option.value"
+    result += " $option.key $option.value"
   }
 }
+return result

Modified: db/torque/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema-mysql.sql
==============================================================================
--- db/torque/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema-mysql.sql	Tue Oct 13 09:35:07 2026	(r1939086)
+++ db/torque/trunk/torque-templates/src/test/resources/org/apache/torque/templates/expected-schema-mysql.sql	Tue Oct 13 09:51:50 2026	(r1939087)
@@ -118,7 +118,7 @@ CREATE TABLE d
     b_id INTEGER NOT NULL,
     a_id INTEGER NOT NULL,
     PRIMARY KEY(d_id, b_id, a_id)
-);
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
 
 
 # -----------------------------------------------------------------------

Modified: db/torque/trunk/torque-templates/src/test/schema/schema.xml
==============================================================================
--- db/torque/trunk/torque-templates/src/test/schema/schema.xml	Tue Oct 13 09:35:07 2026	(r1939086)
+++ db/torque/trunk/torque-templates/src/test/schema/schema.xml	Tue Oct 13 09:51:50 2026	(r1939087)
@@ -238,6 +238,8 @@
 
 
   <table name="d" idMethod="none">
+    <option key="ENGINE" value="InnoDB"/>
+    <option key="DEFAULT CHARSET" value="utf8mb4"/>
     <column name="d_id" required="true"
             primaryKey="true" type="INTEGER"/>
     <column name="name" required="true" size="255" type="VARCHAR"/>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org