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 tf...@apache.org on 2010/09/25 21:46:20 UTC

svn commit: r1001308 - in /db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql: outlets/ templates/ddl/ templates/ddl/derby/ templates/ddl/mssql/ templates/ddl/mysql/ templates/ddl/oracle/ templates/ddl/postgresql/

Author: tfischer
Date: Sat Sep 25 19:46:20 2010
New Revision: 1001308

URL: http://svn.apache.org/viewvc?rev=1001308&view=rev
Log:
TORQUE-45: drop contraints before dropping table

Added:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropForeignKey.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropTable.vm
      - copied unchanged from r999223, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/drop.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/dropForeignKey.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/dropTable.vm
      - copied unchanged from r999223, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/drop.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/dropForeignKey.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/dropTable.vm
      - copied unchanged from r999223, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/drop.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropForeignKey.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropTable.vm
      - copied, changed from r999223, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/drop.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/dropForeignKey.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/dropTable.vm
      - copied unchanged from r999223, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/drop.vm
Removed:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/drop.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/drop.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/drop.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/drop.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/drop.vm
Modified:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/outlets/ddl.xml
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/tableSkipDecider.vm

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/outlets/ddl.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/outlets/ddl.xml?rev=1001308&r1=1001307&r2=1001308&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/outlets/ddl.xml (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/outlets/ddl.xml Sat Sep 25 19:46:20 2010
@@ -28,6 +28,14 @@
       <action xsi:type="applyAction" 
           outlet="torque.sql.ddl.databaseStart"/>
     </mergepoint>
+    <mergepoint name="drop">
+      <action xsi:type="traverseAllAction" 
+          element="table" 
+          outlet="torque.sql.ddl.dropForeignKeySkipDecider"/>
+      <action xsi:type="traverseAllAction" 
+          element="table" 
+          outlet="torque.sql.ddl.dropTableSkipDecider"/>
+    </mergepoint>
     <mergepoint name="tables">
       <action xsi:type="traverseAllAction" 
           element="table" 
@@ -46,6 +54,25 @@
     <mergepoint name="databaseEnd" />
   </outlet>
 
+  <outlet name="torque.sql.ddl.dropForeignKeySkipDecider"
+      xsi:type="velocityOutlet"
+      path="ddl/tableSkipDecider.vm">
+    <mergepoint name="table">
+      <action xsi:type="traverseAllAction" 
+          element="foreign-key" 
+          outlet="torque.sql.ddl.dropForeignKey"/>
+    </mergepoint>
+  </outlet>
+
+  <outlet name="torque.sql.ddl.dropTableSkipDecider"
+      xsi:type="velocityOutlet"
+      path="ddl/tableSkipDecider.vm">
+    <mergepoint name="table">
+      <action xsi:type="applyAction"
+          outlet="torque.sql.ddl.dropTable"/>
+    </mergepoint>
+  </outlet>
+
   <outlet name="torque.sql.ddl.tableSkipDecider"
       xsi:type="velocityOutlet"
       path="ddl/tableSkipDecider.vm">
@@ -84,10 +111,6 @@
   <outlet name="torque.sql.ddl.table"
       xsi:type="velocityOutlet"
       path="ddl/${option:database}/table.vm">
-    <mergepoint name="drop">
-      <action xsi:type="applyAction"
-          outlet="torque.sql.ddl.drop"/>
-    </mergepoint>
     <mergepoint name="columns">
       <action xsi:type="traverseAllAction"
           element="column"
@@ -113,9 +136,13 @@
     </mergepoint>
   </outlet>
 
-  <outlet name="torque.sql.ddl.drop"
+  <outlet name="torque.sql.ddl.dropTable"
+      xsi:type="velocityOutlet"
+      path="ddl/${option:database}/dropTable.vm" />
+
+  <outlet name="torque.sql.ddl.dropForeignKey"
       xsi:type="velocityOutlet"
-      path="ddl/${option:database}/drop.vm" />
+      path="ddl/${option:database}/dropForeignKey.vm" />
 
   <outlet name="torque.sql.ddl.column"
       xsi:type="velocityOutlet"

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm?rev=1001308&r1=1001307&r2=1001308&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/database.vm Sat Sep 25 19:46:20 2010
@@ -15,5 +15,8 @@
 ## specific language governing permissions and limitations
 ## under the License.
 $torqueGen.mergepoint("databaseStart")
+$torqueGen.mergepoint("drop")
 $torqueGen.mergepoint("tables")
+$torqueGen.mergepoint("foreignKeys")
+$torqueGen.mergepoint("comments")
 $torqueGen.mergepoint("databaseEnd")
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropForeignKey.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropForeignKey.vm?rev=1001308&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropForeignKey.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/derby/dropForeignKey.vm Sat Sep 25 19:46:20 2010
@@ -0,0 +1,20 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+ALTER TABLE $torqueGen.getParent().getAttribute("name")
+    DROP CONSTRAINT $name;
+
+

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/dropForeignKey.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/dropForeignKey.vm?rev=1001308&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/dropForeignKey.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mssql/dropForeignKey.vm Sat Sep 25 19:46:20 2010
@@ -0,0 +1,20 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+ALTER TABLE $torqueGen.getParent().getAttribute("name")
+    DROP CONSTRAINT $name;
+
+

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/dropForeignKey.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/dropForeignKey.vm?rev=1001308&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/dropForeignKey.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/mysql/dropForeignKey.vm Sat Sep 25 19:46:20 2010
@@ -0,0 +1,20 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+ALTER TABLE $torqueGen.getParent().getAttribute("name")
+    DROP FOREIGN KEY $name;
+
+

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropForeignKey.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropForeignKey.vm?rev=1001308&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropForeignKey.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropForeignKey.vm Sat Sep 25 19:46:20 2010
@@ -0,0 +1,20 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+ALTER TABLE $torqueGen.getParent().getAttribute("name")
+    DROP CONSTRAINT $name;
+
+

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropTable.vm (from r999223, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/drop.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropTable.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropTable.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/drop.vm&r1=999223&r2=1001308&rev=1001308&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/drop.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/oracle/dropTable.vm Sat Sep 25 19:46:20 2010
@@ -18,3 +18,4 @@ DROP TABLE $name CASCADE CONSTRAINTS;
 #if ($idMethod == "native")
 DROP SEQUENCE $sequenceName;
 #end
+

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/dropForeignKey.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/dropForeignKey.vm?rev=1001308&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/dropForeignKey.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/postgresql/dropForeignKey.vm Sat Sep 25 19:46:20 2010
@@ -0,0 +1,20 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+ALTER TABLE $torqueGen.getParent().getAttribute("name")
+    DROP CONSTRAINT $name;
+
+

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/tableSkipDecider.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/tableSkipDecider.vm?rev=1001308&r1=1001307&r2=1001308&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/tableSkipDecider.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/templates/ddl/tableSkipDecider.vm Sat Sep 25 19:46:20 2010
@@ -16,6 +16,4 @@
 ## under the License.
 #if (!$skipSql.equals("true"))##
 $torqueGen.mergepoint("table")##
-$torqueGen.mergepoint("foreignKeys")
-$torqueGen.mergepoint("comments")
 #end
\ No newline at end of file



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