From: Peter Rabbitson <ribasushi@cpan.org>
Date: Thu, 10 Jan 2013 17:15:52 +0000 (+0100)
Subject: SQLT got a lot better lately - bump min version
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7536c92b1affd50dd567cb1acae7a38f2222d04d;p=dbsrgits%2FDBIx-Class-Historic.git

SQLT got a lot better lately - bump min version

Remove a large number of workarounds in the process
---

diff --git a/lib/DBIx/Class/Optional/Dependencies.pm b/lib/DBIx/Class/Optional/Dependencies.pm
index c1b6be5..a6cbb49 100644
--- a/lib/DBIx/Class/Optional/Dependencies.pm
+++ b/lib/DBIx/Class/Optional/Dependencies.pm
@@ -151,7 +151,7 @@ my $reqs = {
 
   deploy => {
     req => {
-      'SQL::Translator'           => '0.11006',
+      'SQL::Translator'           => '0.11016',
     },
     pod => {
       title => 'Storage::DBI::deploy()',
diff --git a/lib/SQL/Translator/Parser/DBIx/Class.pm b/lib/SQL/Translator/Parser/DBIx/Class.pm
index e4f7a9b..dc13790 100644
--- a/lib/SQL/Translator/Parser/DBIx/Class.pm
+++ b/lib/SQL/Translator/Parser/DBIx/Class.pm
@@ -16,7 +16,7 @@ use Exporter;
 use SQL::Translator::Utils qw(debug normalize_name);
 use DBIx::Class::Carp qw/^SQL::Translator|^DBIx::Class|^Try::Tiny/;
 use DBIx::Class::Exception;
-use Scalar::Util qw/weaken blessed/;
+use Scalar::Util 'blessed';
 use Try::Tiny;
 use namespace::clean;
 
@@ -40,11 +40,6 @@ sub parse {
     $dbicschema     ||= $args->{'package'};
     my $limit_sources = $args->{'sources'};
 
-    # this is a hack to prevent schema leaks due to a retarded SQLT implementation
-    # DO NOT REMOVE (until SQLT2 is out, the all of this will be rewritten anyway)
-    ref $_ and weaken $_
-      for $_[1], $dbicschema, @{$args}{qw/DBIx::Schema DBIx::Class::Schema package/};
-
     DBIx::Class::Exception->throw('No DBIx::Class::Schema') unless ($dbicschema);
     if (!ref $dbicschema) {
       eval "require $dbicschema"
diff --git a/t/52leaks.t b/t/52leaks.t
index 2f70414..800ec22 100644
--- a/t/52leaks.t
+++ b/t/52leaks.t
@@ -360,8 +360,8 @@ for my $slot (keys %$weak_registry) {
     # Moo keeps globals around, this is normal
     delete $weak_registry->{$slot};
   }
-  elsif ($slot =~ /^SQL::Translator/) {
-    # SQLT is a piece of shit, leaks all over
+  elsif ($slot =~ /^SQL::Translator::Generator::DDL::SQLite/) {
+    # SQLT got much better, but still leaks a little
     delete $weak_registry->{$slot};
   }
   elsif ($slot =~ /^Hash::Merge/) {
diff --git a/t/storage/replicated.t b/t/storage/replicated.t
index 6919e5f..c8d469f 100644
--- a/t/storage/replicated.t
+++ b/t/storage/replicated.t
@@ -79,15 +79,8 @@ TESTSCHEMACLASSES: {
     ## Get the Schema and set the replication storage type
 
     sub init_schema {
-        # current SQLT SQLite producer does not handle DROP TABLE IF EXISTS, trap warnings here
-        local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /no such table.+DROP TABLE/s };
-
-        my ($class, $schema_method) = @_;
-
-        my $method = "get_schema_$schema_method";
-        my $schema = $class->$method;
-
-        return $schema;
+        #my ($class, $schema_getter) = @_;
+        shift->${\ ( 'get_schema_' . shift ) };
     }
 
     sub get_schema_by_storage_type {