From: Philipp Gortan Date: Wed, 14 Jan 2015 09:57:53 +0000 (+0100) Subject: Filter out disabled constraints and triggers for Oracle (GH#5) X-Git-Tag: 0.07043~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-Schema-Loader.git;a=commitdiff_plain;h=48c1a6c5fea9f320f94d583f79936b43c6d38710 Filter out disabled constraints and triggers for Oracle (GH#5) --- diff --git a/Changes b/Changes index 0d28eb5..6a57023 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,7 @@ Revision history for Perl extension DBIx::Class::Schema::Loader - Remove dependency on List::MoreUtils and Sub::Name - Ensure schema files are generated as binary files on Windows - Fix overwrite_modifications not overwriting if the table hasn't changed + - Filter out disabled constraints and triggers for Oracle (GH#5) 0.07042 2014-08-20 - Fix unescaped left braces in regexes in tests diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm index 5411f80..baf7320 100644 --- a/lib/DBIx/Class/Schema/Loader.pm +++ b/lib/DBIx/Class/Schema/Loader.pm @@ -681,6 +681,8 @@ moritz: Moritz Lenz oalders: Olaf Alders +mephinet: Philipp Gortan + ... and lots of other folks. If we forgot you, please write the current maintainer or RT. diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm index 4da911f..47bec5a 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm @@ -85,7 +85,7 @@ sub _table_fk_info { my $deferrable_sth = $self->dbh->prepare_cached(<<'EOF'); select deferrable from all_constraints -where owner = ? and table_name = ? and constraint_name = ? +where owner = ? and table_name = ? and constraint_name = ? and status = 'ENABLED' EOF foreach my $rel (@$rels) { @@ -112,7 +112,8 @@ FROM all_constraints ac, all_cons_columns acc WHERE acc.table_name=? AND acc.owner = ? AND ac.table_name = acc.table_name AND ac.owner = acc.owner AND acc.constraint_name = ac.constraint_name - AND ac.constraint_type='U' + AND ac.constraint_type = 'U' + AND ac.status = 'ENABLED' ORDER BY acc.position EOF @@ -177,7 +178,7 @@ sub _columns_info_for { my $sth = $self->dbh->prepare_cached(<<'EOF', {}, 1); SELECT trigger_body FROM all_triggers -WHERE table_name = ? AND table_owner = ? +WHERE table_name = ? AND table_owner = ? AND status = 'ENABLED' AND upper(trigger_type) LIKE '%BEFORE EACH ROW%' AND lower(triggering_event) LIKE '%insert%' EOF