diff options
Diffstat (limited to 'db/rerun_dbic_loader.pl')
-rwxr-xr-x | db/rerun_dbic_loader.pl | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/db/rerun_dbic_loader.pl b/db/rerun_dbic_loader.pl new file mode 100755 index 000000000..13316ad09 --- /dev/null +++ b/db/rerun_dbic_loader.pl @@ -0,0 +1,46 @@ +#!/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 = ( + 'admin_log', # + 'alert', # + 'alert_sent', # + 'alert_type', # + 'comment', # + 'contacts_history', # + 'debugdate', # + 'flickr_imported', # + 'partial_user', # + 'questionnaire', # + 'secret', # + 'textmystreet', # +); +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 + + # add in some extra components + components => ['FilterColumn'], + + }, + FixMyStreet->dbic_connect_info(), +); + |