[freeside-commits] freeside/FS/bin freeside-setup,1.52,1.53
Ivan,,,
ivan at wavetail.420.am
Wed Dec 7 15:49:00 PST 2005
Update of /home/cvs/cvsroot/freeside/FS/bin
In directory wavetail:/tmp/cvs-serv9907/FS/bin
Modified Files:
freeside-setup
Log Message:
for fetching inserted keys without pg_oid_status, look up the actual sequence name from dbdef rather than assuming ${table}_${column}_seq
Index: freeside-setup
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-setup,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- freeside-setup 17 Aug 2005 22:23:45 -0000 1.52
+++ freeside-setup 7 Dec 2005 23:48:58 -0000 1.53
@@ -9,7 +9,7 @@
use Locale::Country;
use Locale::SubCountry;
use FS::UID qw(adminsuidsetup datasrc checkeuid getsecrets);
-use FS::Schema qw( dbdef_dist );
+use FS::Schema qw( dbdef_dist reload_dbdef );
use FS::Record;
use FS::cust_main_county;
#use FS::raddb;
@@ -98,6 +98,12 @@
or die "CREATE error: ". $dbh->errstr. "\ndoing statement: $statement";
}
+#now go back and reverse engineer the db
+#so we pick up the correct column DEFAULTs for #oidless inserts
+dbdef_create($dbh, $dbdef_file);
+delete $FS::Schema::dbdef_cache{$dbdef_file}; #force an actual reload
+reload_dbdef($dbdef_file);
+
#cust_main_county
foreach my $country ( sort map uc($_), all_country_codes ) {
@@ -162,6 +168,12 @@
#print "Freeside database initialized sucessfully\n";
+sub dbdef_create { # reverse engineer the schema from the DB and save to file
+ my( $dbh, $file ) = @_;
+ my $dbdef = new_native DBIx::DBSchema $dbh;
+ $dbdef->save($file);
+}
+
sub usage {
die "Usage:\n freeside-setup user\n";
}
More information about the freeside-commits
mailing list