| 1 | package Mail::Decency::Core::DatabaseCreate; | ||||||||||
| 2 | |||||||||||
| 3 | 20 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 20 | ▶ | use version 0.74; our $VERSION = qv( "v0.1.4" ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | =head1 NAME | ||||||||||
| 8 | |||||||||||
| 9 | Mail::Decency::Core::Meta::DatabaseCreate | ||||||||||
| 10 | |||||||||||
| 11 | =head1 DESCRIPTION | ||||||||||
| 12 | |||||||||||
| 13 | Prints SQL CREATE statements for module and server databases. Of course, only for DBD databases.. | ||||||||||
| 14 | |||||||||||
| 15 | =head1 METHODS | ||||||||||
| 16 | |||||||||||
| 17 | |||||||||||
| 18 | =head2 print_sql | ||||||||||
| 19 | |||||||||||
| 20 | Print SQL "CREATE *" statements. | ||||||||||
| 21 | |||||||||||
| 22 | =cut | ||||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | sub print_sql { | ||||||||
|
Subroutine
print_sql: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||
| 25 | 0 | my ( $self ) = @_; | |||||||||
| 26 | |||||||||||
| 27 | 0 | print "-- SQL START\n\n"; | |||||||||
| 28 | |||||||||||
| 29 | 0 | foreach my $child( @{ $self->childs }, $self ) { | |||||||||
| 30 | 0 | ▶ | next unless $child->can( 'schema_definition' ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | my $definition_ref = $child->schema_definition; | |||||||||
| 32 | 0 | print "-- For: $child\n"; | |||||||||
| 33 | 0 | ▶ | while( my ( $schema, $tables_ref ) = each %$definition_ref ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | ▶ | while ( my ( $table, $columns_ref ) = each %$tables_ref ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 0 | $child->database->setup( $schema => $table => $columns_ref, 0 ); | |||||||||
| 36 | 0 | print "\n"; | |||||||||
| 37 | } | ||||||||||
| 38 | } | ||||||||||
| 39 | 0 | print "\n"; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 0 | print "\n-- SQL END\n"; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | =head1 AUTHOR | ||||||||||
| 46 | |||||||||||
| 47 | Ulrich Kautz <uk@fortrabbit.de> | ||||||||||
| 48 | |||||||||||
| 49 | =head1 COPYRIGHT | ||||||||||
| 50 | |||||||||||
| 51 | Copyright (c) 2010 the L</AUTHOR> as listed above | ||||||||||
| 52 | |||||||||||
| 53 | =head1 LICENCSE | ||||||||||
| 54 | |||||||||||
| 55 | This library is free software and may be distributed under the same terms as perl itself. | ||||||||||
| 56 | |||||||||||
| 57 | =cut | ||||||||||
| 58 | |||||||||||
| 59 | |||||||||||
| 60 | 20 | 1; | |||||||||