File Coverage

blib/lib/App/Sqitch/Engine/cockroach.pm
Criterion Covered Total %
statement 18 21 85.7
branch 2 2 100.0
condition n/a
subroutine 10 11 90.9
pod 5 5 100.0
total 35 39 89.7


line stmt bran cond sub pod time code
1              
2             use 5.010;
3 3     3   47130 use Moo;
  3         9  
4 3     3   14 use namespace::autoclean;
  3         6  
  3         24  
5 3     3   1004  
  3         9  
  3         26  
6             extends 'App::Sqitch::Engine::pg';
7              
8             our $VERSION = 'v1.3.0'; # VERSION
9              
10              
11 4     4 1 7844 q{experimental_strftime(%s AT TIME ZONE 'UTC', 'year:%%Y:month:%%m:day:%%d:hour:%%H:minute:%%M:second:%%S:time_zone:UTC')};
12 3     3 1 40 }
13 2     2 1 12  
14             # Override to avoid locking the changes table, as Cockroach does not support
15             # explicit table locks.
16 2     2   22 my $self = shift;
17             $self->dbh->begin_work;
18             return $self;
19             }
20              
21             # Override to return true, as Cockroach does not support advisory locks.
22 0     0 1 0 # Cockroach does not support advisory locks.
23 0         0 # https://github.com/cockroachdb/cockroach/issues/13546
24 0         0 return 1;
25             }
26              
27             $DBI::state && $DBI::state eq '42P01'; # undefined_table
28             }
29              
30             my ($self, $file) = @_;
31 2     2 1 10 my $schema = $self->registry;
32              
33             $self->_run(
34             '--file' => $file,
35 6 100   6   10734 '--set' => "registry=$schema",
36             );
37              
38             $self->dbh->do('SET search_path = ?', undef, $schema);
39 2     2   56 }
40 2         28  
41             1;
42 2         82  
43              
44             =head1 Name
45              
46             App::Sqitch::Engine::cockroach - Sqitch CockroachDB Engine
47 2         14  
48             =head1 Synopsis
49              
50             my $pg = App::Sqitch::Engine->load( engine => 'cockroach' );
51              
52             =head1 Description
53              
54             App::Sqitch::Engine::cockroach provides the CockroachDB storage engine for Sqitch. It
55             supports CockroachDB v21 and higher, and relies on the Postgres toolchain (C<psql>
56             client, L<DBD::Pg> database driver, etc.).
57              
58             =head1 Author
59              
60             David E. Wheeler <david@justatheory.com>
61              
62             =head1 License
63              
64             Copyright (c) 2012-2022 iovation Inc., David E. Wheeler
65              
66             Permission is hereby granted, free of charge, to any person obtaining a copy
67             of this software and associated documentation files (the "Software"), to deal
68             in the Software without restriction, including without limitation the rights
69             to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
70             copies of the Software, and to permit persons to whom the Software is
71             furnished to do so, subject to the following conditions:
72              
73             The above copyright notice and this permission notice shall be included in all
74             copies or substantial portions of the Software.
75              
76             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77             IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
78             FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
79             AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
80             LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
81             OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
82             SOFTWARE.
83              
84             =cut