line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WG::Dev; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3581
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Class::Load; |
6
|
|
|
|
|
|
|
use Cwd; |
7
|
|
|
|
|
|
|
use Log::Any qw/$log/; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has 'wg' => ( is => 'ro' , isa => 'WG' , required => 1 , weak_ref => 1); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
WG::Dev - A developer with all the funky actions he can do. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head2 schema_dump |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Dumps the schema into this code base. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub schema_dump{ |
24
|
|
|
|
|
|
|
my ($self) = @_; |
25
|
|
|
|
|
|
|
Class::Load::load_class('DBIx::Class::Schema::Loader'); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $dump_dir = File::Spec->rel2abs(__FILE__); |
28
|
|
|
|
|
|
|
$dump_dir =~ s/[^\/]+\/Dev\.pm//; |
29
|
|
|
|
|
|
|
$dump_dir = Cwd::realpath($dump_dir); |
30
|
|
|
|
|
|
|
$log->info("Will dump DBIC Schema in $dump_dir as WG::DB"); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $db_conf = $self->wg->config()->{db}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
DBIx::Class::Schema::Loader::make_schema_at( 'WG::DB', |
35
|
|
|
|
|
|
|
{ |
36
|
|
|
|
|
|
|
db_schema => [ 'public' ], |
37
|
|
|
|
|
|
|
qualify_objects => 0, |
38
|
|
|
|
|
|
|
debug => 1, |
39
|
|
|
|
|
|
|
dump_directory => $dump_dir, |
40
|
|
|
|
|
|
|
components => ["FilterColumn", "InflateColumn::DateTime"], |
41
|
|
|
|
|
|
|
}, |
42
|
|
|
|
|
|
|
[ $db_conf->{dsn}, $db_conf->{username}, $db_conf->{password} |
43
|
|
|
|
|
|
|
, {} |
44
|
|
|
|
|
|
|
] |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
return 1; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |