aboutsummaryrefslogtreecommitdiffstats
path: root/db/rerun_dbic_loader.pl
blob: 241a4726bb8826fbb3b6b9b2539aa70f3949d8d9 (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
#!/usr/bin/env perl

use strict;
use warnings;

# This script inspects the current state of the database and then ammends the
# FixMyStreet::DB::Result::* files to suit. After running the changes should be
# inspected before the code is commited.

use FixMyStreet;
use DBIx::Class::Schema::Loader qw/ make_schema_at /;

# create a exclude statement that filters out the table that we are not
# interested in
my @tables_to_ignore = (
    'abuse',         'admin_log',       'alert',        'alert_sent',
    'alert_type',    'comment',         'contacts',     'contacts_history',
    'debugdate',     'flickr_imported', 'partial_user', 'problem',
    'questionnaire', 'secret',          'textmystreet', 'token',
);
my $exclude = '^(?:' . join( '|', @tables_to_ignore ) . ')$';

make_schema_at(
    'FixMyStreet::DB',
    {
        debug          => 0,               # switch on to be chatty
        dump_directory => './lib',         # edit files in place
        exclude        => qr{$exclude},    # ignore some tables
        generate_pod   => 0,               # no need for pod
        overwrite_modifications => 1,      # don't worry that the md5 is wrong
    },
    FixMyStreet->dbic_connect_info(),
);