I think somebody should commit this one until it starts to bitrot badly, see Jason's approval below (I'm inlining the patch again to remove reply quotings).
On Thu, 2002-04-25 at 00:53, Ville Skytt� wrote: > On Wed, 2002-04-24 at 05:45, Jason van Zyl wrote: > > > > The patch below adds support for named foreign keys and unique > > > constraints in PostgreSQL templates as well as has some minor style > > > tweaks. > > > > If you've run the testbed they can go right in, did you run the testbed > > Yes, I did, no failures (except for the ones that are always there from > dropping nonexistent tables). And assuming that you mean "testbed" == > "ant test". Index: src/templates/sql/base/postgresql/drop.vm =================================================================== RCS file: /home/cvspublic/jakarta-turbine-torque/src/templates/sql/base/postgresql/drop.vm,v retrieving revision 1.1.1.1 diff -a -u -r1.1.1.1 drop.vm --- src/templates/sql/base/postgresql/drop.vm 2 Aug 2001 05:08:40 -0000 1.1.1.1 +++ src/templates/sql/base/postgresql/drop.vm 24 Apr 2002 12:19:35 -0000 @@ -1,4 +1,4 @@ -drop table $table.Name; +DROP TABLE $table.Name; #if ($table.IdMethod == "native") -drop sequence $table.SequenceName; -#end \ No newline at end of file +DROP SEQUENCE $table.SequenceName; +#end Index: src/templates/sql/base/postgresql/foreignkey.vm =================================================================== RCS file: /home/cvspublic/jakarta-turbine-torque/src/templates/sql/base/postgresql/foreignkey.vm,v retrieving revision 1.1.1.1 diff -a -u -r1.1.1.1 foreignkey.vm --- src/templates/sql/base/postgresql/foreignkey.vm 2 Aug 2001 05:08:40 -0000 1.1.1.1 +++ src/templates/sql/base/postgresql/foreignkey.vm 24 Apr 2002 12:19:35 -0000 @@ -6,12 +6,13 @@ ## #foreach ($fk in $table.ForeignKeys) ALTER TABLE $table.Name -ADD FOREIGN KEY ($fk.LocalColumnNames) REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames) + ADD CONSTRAINT $fk.Name FOREIGN KEY ($fk.LocalColumnNames) + REFERENCES $fk.ForeignTableName ($fk.ForeignColumnNames) #if ($fk.hasOnUpdate()) -ON UPDATE $fk.OnUpdate + ON UPDATE $fk.OnUpdate #end #if ($fk.hasOnDelete()) -ON DELETE $fk.OnDelete + ON DELETE $fk.OnDelete #end ; #end Index: src/templates/sql/base/postgresql/index.vm =================================================================== RCS file: /home/cvspublic/jakarta-turbine-torque/src/templates/sql/base/postgresql/index.vm,v retrieving revision 1.4 diff -a -u -r1.4 index.vm --- src/templates/sql/base/postgresql/index.vm 22 Aug 2001 02:08:42 -0000 1.4 +++ src/templates/sql/base/postgresql/index.vm 24 Apr 2002 12:19:35 -0000 @@ -1,4 +1,4 @@ #foreach ($index in $table.Indices) -create #if($index.Unique)unique#end INDEX $index.Name on $table.Name ($index.ColumnList); +CREATE#if($index.Unique) UNIQUE#end INDEX $index.Name ON $table.Name +($index.ColumnList); #end Index: src/templates/sql/base/postgresql/primarykey.vm =================================================================== RCS file: /home/cvspublic/jakarta-turbine-torque/src/templates/sql/base/postgresql/primarykey.vm,v retrieving revision 1.2 diff -a -u -r1.2 primarykey.vm --- src/templates/sql/base/postgresql/primarykey.vm 15 Nov 2001 13:23:46 -0000 1.2 +++ src/templates/sql/base/postgresql/primarykey.vm 24 Apr 2002 12:19:35 -0000 @@ -1,3 +1,3 @@ #if ($table.hasPrimaryKey()) - PRIMARY KEY($table.printPrimaryKey()), + PRIMARY KEY ($table.printPrimaryKey()), #end Index: src/templates/sql/base/postgresql/unique.vm =================================================================== RCS file: /home/cvspublic/jakarta-turbine-torque/src/templates/sql/base/postgresql/unique.vm,v retrieving revision 1.1.1.1 diff -a -u -r1.1.1.1 unique.vm --- src/templates/sql/base/postgresql/unique.vm 2 Aug 2001 05:08:40 -0000 1.1.1.1 +++ src/templates/sql/base/postgresql/unique.vm 24 Apr 2002 12:19:36 -0000 @@ -1,3 +1,3 @@ #foreach ($unique in $table.Unices) - UNIQUE ($unique.ColumnList), -#end \ No newline at end of file + CONSTRAINT $unique.Name UNIQUE ($unique.ColumnList), +#end -- Ville Skytt� [EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
