Hi all,


I've just started using Torque Gen and I noticed there was a small problem when generating the scripts for PostgreSQL.
For the moment the drop.vm starts something like this :


DROP TABLE $table.Name;

The problem is that with advanced schemas containing unique and foreign keys, this fails because PostgreSQL build external resources attached to the table name. Using the following works a lot better :

DROP TABLE $table.Name CASCADE;

Also I am submitting a patch containing this and another small modification to the drop.vm for MSSQL that makes the resulting SQL schema file a lot easier to parse because every command is separate with ";" characters. I use this in my own templates but I thought it might be useful to others.

Regards,
Serge Huber.
Index: src/generator/src/templates/sql/base/mssql/drop.vm
===================================================================
RCS file: 
/home/cvspublic/db-torque/src/generator/src/templates/sql/base/mssql/drop.vm,v
retrieving revision 1.1
diff -u -r1.1 drop.vm
--- src/generator/src/templates/sql/base/mssql/drop.vm  10 Feb 2003 13:18:49 -0000     
 1.1
+++ src/generator/src/templates/sql/base/mssql/drop.vm  27 Feb 2004 17:33:35 -0000
@@ -26,4 +26,4 @@
      DEALLOCATE refcursor
      DROP TABLE $table.Name
 END
-
+;
Index: src/generator/src/templates/sql/base/postgresql/drop.vm
===================================================================
RCS file: 
/home/cvspublic/db-torque/src/generator/src/templates/sql/base/postgresql/drop.vm,v
retrieving revision 1.1
diff -u -r1.1 drop.vm
--- src/generator/src/templates/sql/base/postgresql/drop.vm     10 Feb 2003 13:18:47 
-0000      1.1
+++ src/generator/src/templates/sql/base/postgresql/drop.vm     27 Feb 2004 17:33:35 
-0000
@@ -1,4 +1,4 @@
-DROP TABLE $table.Name;
+DROP TABLE $table.Name CASCADE;
 #if ($table.IdMethod == "native")
 DROP SEQUENCE $table.SequenceName;
 #end

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to