import rt 3.8.7
[freeside.git] / rt / sbin / factory
index 6b2d896..78a0159 100644 (file)
@@ -2,8 +2,8 @@
 # BEGIN BPS TAGGED BLOCK {{{
 # 
 # COPYRIGHT:
-#  
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC 
+# 
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
 #                                          <jesse@bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -49,6 +49,8 @@
 use strict;
 use DBI;
 
+die "Usage: $0 database namespace" if @ARGV != 2;
+
 my $database  = shift;
 my $namespace = shift;
 
@@ -65,8 +67,8 @@ my $LicenseBlock = << '.';
 # BEGIN BPS TAGGED BLOCK {{{
 # 
 # COPYRIGHT:
-#  
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+# 
+# This software is Copyright (c) 1996-2008 Best Practical Solutions, LLC
 #                                          <jesse@bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -86,7 +88,9 @@ my $LicenseBlock = << '.';
 # 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 or visit their web page on the internet at
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 # 
 # 
 # CONTRIBUTION SUBMISSION POLICY:
@@ -110,6 +114,7 @@ my $LicenseBlock = << '.';
 .
 
 my $Attribution = << '.';
+
 # Autogenerated by DBIx::SearchBuilder factory (by <jesse@bestpractical.com>)
 # WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST.  
 # 
@@ -124,7 +129,7 @@ my $dsn = "DBI:$driver:database=$database;host=$hostname";
 my $dbh = DBI->connect( $dsn, $user, $password );
 
 #get all tables out of database
-my @tables = $dbh->tables();
+my @tables = map { s/^\`\Q$database\E\`\.//; $_ } $dbh->tables();
 
 my ( %tablemap, $typemap, %modulemap );