[DBIx-Class-Devel] [dbsrgits/sql-translator] PostgreSQL: add support for TRIGGERs and FUNCTIONs (#82)

Eugen Konkov notifications at github.com
Tue Jan 31 07:07:58 GMT 2017


Also I have changed this:
```
--- a/lib/SQL/Translator/Producer/PostgreSQL.pm
+++ b/lib/SQL/Translator/Producer/PostgreSQL.pm
@@ -595,12 +595,10 @@ sub create_index
     if ( $type eq PRIMARY_KEY ) {
         push @constraint_defs, "${def_start}PRIMARY KEY ".$field_names;
     }
-    elsif ( $type eq UNIQUE ) {
-        push @constraint_defs, "${def_start}UNIQUE " .$field_names;
-    }
-    elsif ( $type eq NORMAL ) {
+    elsif ( $type eq NORMAL  ||  $type eq UNIQUE ) {
+        my $unique =  $type eq UNIQUE ? 'UNIQUE' : '';
         $index_def =
-            'CREATE INDEX ' . $generator->quote($name) . ' on ' . $generator->quote($table_name) . ' ' .
+            "CREATE $unique INDEX " . $generator->quote($name) . ' on ' . $generator->quote($table_name) . ' ' .
             join ' ', grep { defined } $index_using, $field_names, $index_where;
     }
     else {

```

This allows me create UNIQUE INDEX instead of constraint. I think this is better.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/sql-translator/issues/82#issuecomment-276290608
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20170130/0ff53764/attachment.htm>


More information about the DBIx-Class-Devel mailing list