aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Model/DB.pm
blob: db8e72c27044dc80ff2ab082669fd3593ea7c5e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package FixMyStreet::App::Model::DB;
use base 'Catalyst::Model::DBIC::Schema';

use strict;
use warnings;

use FixMyStreet;
use Catalyst::Utils;
use Moose;

with 'Catalyst::Component::InstancePerContext';

__PACKAGE__->config(
    schema_class => 'FixMyStreet::DB::Schema',
    connect_info => sub { FixMyStreet::DB->schema->storage->dbh },
);
__PACKAGE__->config(
    traits => ['QueryLog::AdoptPlack'],
)
    if Catalyst::Utils::env_value( 'FixMyStreet::App', 'DEBUG' );

sub build_per_context_instance {
    my ( $self, $c ) = @_;
    $self->schema->cache({});
    return $self;
}

=head1 NAME

FixMyStreet::App::Model::DB - Catalyst DBIC Schema Model

=head1 DESCRIPTION

L<Catalyst::Model::DBIC::Schema> Model using schema L<FixMyStreet::DB::Schema>

=cut

1;