diff options
author | Edmund von der Burg <evdb@mysociety.org> | 2011-03-01 15:44:15 +0000 |
---|---|---|
committer | Edmund von der Burg <evdb@mysociety.org> | 2011-03-01 15:44:15 +0000 |
commit | 5fdc7140dbbed9bd3ce8454ad990b3326d850905 (patch) | |
tree | e485e4b8c9c5c691de3c8580553295a91f453f49 /db/rerun_dbic_loader.pl | |
parent | 69dc1b4f49e1d3f596828065aa77f510366f454f (diff) |
changes to schema needed for DBIx::Class
ORM generator script
Diffstat (limited to 'db/rerun_dbic_loader.pl')
-rwxr-xr-x | db/rerun_dbic_loader.pl | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/db/rerun_dbic_loader.pl b/db/rerun_dbic_loader.pl new file mode 100755 index 000000000..241a4726b --- /dev/null +++ b/db/rerun_dbic_loader.pl @@ -0,0 +1,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(), +); + |