File Coverage

blib/lib/DBIx/Class/DeploymentHandler/VersionStorage/Standard/VersionResult.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 21 22 95.4


line stmt bran cond sub pod time code
1             package DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult;
2             $DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult::VERSION = '0.002232';
3             # ABSTRACT: The typical way to store versions in the database
4              
5 18     18   132 use strict;
  18         46  
  18         578  
6 18     18   115 use warnings;
  18         46  
  18         489  
7              
8 18     18   105 use parent 'DBIx::Class::Core';
  18         50  
  18         153  
9              
10             my $table = 'dbix_class_deploymenthandler_versions';
11              
12             __PACKAGE__->table($table);
13              
14             __PACKAGE__->add_columns (
15             id => {
16             data_type => 'int',
17             is_auto_increment => 1,
18             },
19             version => {
20             data_type => 'varchar',
21             # size needs to be at least
22             # 40 to support SHA1 versions
23             size => '50'
24             },
25             ddl => {
26             data_type => 'text',
27             is_nullable => 1,
28             },
29             upgrade_sql => {
30             data_type => 'text',
31             is_nullable => 1,
32             },
33             );
34              
35             __PACKAGE__->set_primary_key('id');
36             __PACKAGE__->add_unique_constraint(['version']);
37             __PACKAGE__->resultset_class('DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResultSet');
38              
39             sub sqlt_deploy_hook {
40 28     28 0 567310 my ( $self, $sqlt_table ) = @_;
41 28         579 my $tname = $sqlt_table->name;
42 28 100       2945 return if $tname eq $table;
43             # give indices unique names for sub-classes on different tables
44 5         26 foreach my $c ( $sqlt_table->get_constraints ) {
45 10         427 ( my $cname = $c->name ) =~ s/\Q$table\E/$tname/;
46 10         524 $c->name($cname);
47             }
48             }
49              
50             1;
51              
52             # vim: ts=2 sw=2 expandtab
53              
54             __END__
55              
56             =pod
57              
58             =head1 NAME
59              
60             DBIx::Class::DeploymentHandler::VersionStorage::Standard::VersionResult - The typical way to store versions in the database
61              
62             =head1 AUTHOR
63              
64             Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
65              
66             =head1 COPYRIGHT AND LICENSE
67              
68             This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt.
69              
70             This is free software; you can redistribute it and/or modify it under
71             the same terms as the Perl 5 programming language system itself.
72              
73             =cut