[Jifty-commit] r6779 - Jifty-DBI/trunk/lib/Jifty/DBI
Jifty commits
jifty-commit at lists.jifty.org
Wed Apr 15 13:39:42 EDT 2009
Author: ruz
Date: Wed Apr 15 13:39:41 2009
New Revision: 6779
Modified:
Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
Log:
* ALTER TABLE for rename_table shows better consistency over DBs
Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm (original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm Wed Apr 15 13:39:41 2009
@@ -1305,14 +1305,19 @@
);
}
+
=head3 rename_table
+Renames a table in the DB. Takes 'table' and new name of it in 'to'.
+
=cut
sub rename_table {
my $self = shift;
my %args = (table => undef, to => undef, @_);
- return $self->simple_query("RENAME TABLE $args{'table'} TO $args{'to'}");
+# mysql has RENAME TABLE, but alter can rename temporary
+# Oracle, Pg, SQLite are ok with this
+ return $self->simple_query("ALTER TABLE $args{'table'} RENAME TO $args{'to'}");
}
=head2 DESTROY
More information about the Jifty-commit
mailing list