new features
[freeside.git] / bin / dbdef-create
1 #!/usr/bin/perl -Tw
2
3 use strict;
4 use DBI;
5 use DBIx::DBSchema 0.22;
6 use FS::UID qw(adminsuidsetup datasrc driver_name);
7
8 my $user = shift or die &usage;
9
10 my($dbh)=adminsuidsetup $user;
11
12 #needs to match FS::Record
13 my($dbdef_file) = "/usr/local/etc/freeside/dbdef.". datasrc;
14
15 my $dbdef = new_native DBIx::DBSchema $dbh;
16
17 #print $dbdef->pretty_print;
18
19 #important
20 $dbdef->save($dbdef_file);
21
22 sub usage {
23   die "Usage:\n  dbdef-create user\n";
24 }