Skip Menu |

This queue is for tickets about the DBIx-DBSchema CPAN distribution.

Report information
The Basics
Id: 27936
Status: resolved
Priority: 0/
Queue: DBIx-DBSchema

People
Owner: ivan-pause [...] 420.am
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.33
  • 0.01
  • 0.11
  • 0.13
  • 0.14
  • 0.15
  • 0.16
  • 0.17
  • 0.18
  • 0.19
  • 0.20
  • 0.21
  • 0.22
  • 0.23
  • 0.24
  • 0.25
  • 0.26
  • 0.27
  • 0.28
  • 0.29
  • 0.30
  • 0.31
  • 0.32
Fixed in: 0.34



Subject: Drop table implementation
The attached patch has a naive implementation for DROP TABLE. Regards, Slaven
Subject: dbix-dbschema-droptable.patch
Index: DBSchema.pm =================================================================== --- DBSchema.pm (revision 22520) +++ DBSchema.pm (working copy) @@ -289,8 +289,18 @@ } - # should eventually drop tables not in $new + # drop tables not in $new + foreach my $table ( $self->tables ) { + if ( !$new->table($table) ) { + + warn "table $table should be dropped.\n" if $DEBUG; + + push @r, + $self->table($table)->sql_drop_table( $dbh ); + } + } + warn join("\n", @r). "\n" if $DEBUG > 1; @@ -537,3 +547,7 @@ 1; +# Local Variables: +# mode: cperl +# cperl-indent-level: 2 +# End: Index: DBSchema/Table.pm =================================================================== --- DBSchema/Table.pm (revision 22520) +++ DBSchema/Table.pm (working copy) @@ -697,6 +697,14 @@ } +sub sql_drop_table { + my( $self, $dbh ) = ( shift, _dbh(@_) ); + + my $name = $self->name; + + ("DROP TABLE $name"); +} + sub _null_sth { my($dbh, $table) = @_; my $sth = $dbh->prepare("SELECT * FROM $table WHERE 1=0")
From: ivan-pause [...] 420.am
On Tue Jul 03 06:25:58 2007, SREZIC wrote: Show quoted text
> The attached patch has a naive implementation for DROP TABLE.
Thanks! Checked into CVS, will be in 0.34