From: Stephen Bennett Date: Sat, 20 Nov 2010 22:09:54 +0000 (+0000) Subject: Use CASCADE when dropping a postgres enum type, to be consistent with table drops X-Git-Tag: v0.11008~31 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d25db7329ca9549bae56af466715150ffa884425;p=dbsrgits%2FSQL-Translator.git Use CASCADE when dropping a postgres enum type, to be consistent with table drops --- diff --git a/lib/SQL/Translator/Producer/PostgreSQL.pm b/lib/SQL/Translator/Producer/PostgreSQL.pm index 485fae4..1526d79 100644 --- a/lib/SQL/Translator/Producer/PostgreSQL.pm +++ b/lib/SQL/Translator/Producer/PostgreSQL.pm @@ -512,7 +512,7 @@ sub create_view { if ($postgres_version >= 8.003 && $field->data_type eq 'enum') { my $type_name = $extra{'custom_type_name'} || $field->table->name . '_' . $field->name . '_type'; $field_def .= ' '. $type_name; - my $new_type_def = "DROP TYPE IF EXISTS $type_name;\n" . + my $new_type_def = "DROP TYPE IF EXISTS $type_name CASCADE;\n" . "CREATE TYPE $type_name AS ENUM ($commalist)"; if (! exists $type_defs->{$type_name} ) { $type_defs->{$type_name} = $new_type_def;