diff options
author | Struan Donald <struan@exo.org.uk> | 2011-07-29 16:31:15 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-07-29 16:31:15 +0100 |
commit | bb222249d7f836fd27183c2f6b0685191e0100d4 (patch) | |
tree | 769c5b13471fb6ae9414ba44269b0850c7c5412c | |
parent | c2f72c17beab89d473e1776aa1662a68dc5e04be (diff) |
add extra column to problem for storing addition open311 meta information
-rw-r--r-- | db/schema.sql | 1 | ||||
-rw-r--r-- | db/schema_0009-add_extra_to_problem.sql | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 26 |
3 files changed, 31 insertions, 2 deletions
diff --git a/db/schema.sql b/db/schema.sql index 9c5b3d8fd..37ffddd51 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -176,6 +176,7 @@ create table problem ( lastupdate timestamp not null default ms_current_timestamp(), whensent timestamp, send_questionnaire boolean not null default 't' + extra text -- extra fields required for open311 ); create index problem_state_latitude_longitude_idx on problem(state, latitude, longitude); create index problem_user_id_idx on problem ( user_id ); diff --git a/db/schema_0009-add_extra_to_problem.sql b/db/schema_0009-add_extra_to_problem.sql new file mode 100644 index 000000000..bac5806c7 --- /dev/null +++ b/db/schema_0009-add_extra_to_problem.sql @@ -0,0 +1,6 @@ +begin; + +ALTER TABLE problem + ADD COLUMN extra TEXT; + +commit; diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index ff730958a..09d1e058a 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -78,6 +78,8 @@ __PACKAGE__->add_columns( { data_type => "timestamp", is_nullable => 1 }, "send_questionnaire", { data_type => "boolean", default_value => \"true", is_nullable => 0 }, + "extra", + { data_type => "text", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->has_many( @@ -100,8 +102,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3sw/1dqxlTvcWEI/eJTm4w +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-07-29 16:26:23 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ifvx9FOlbui66hPyzNIAPA # Add fake relationship to stored procedure table __PACKAGE__->has_many( @@ -111,11 +113,31 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +__PACKAGE__->filter_column( + extra => { + filter_from_storage => sub { + my $self = shift; + my $ser = shift; + return undef unless defined $ser; + my $h = new IO::String($ser); + return RABX::wire_rd($h); + }, + filter_to_storage => sub { + my $self = shift; + my $data = shift; + my $ser = ''; + my $h = new IO::String($ser); + RABX::wire_wr( $data, $h ); + return $ser; + }, + } +); use DateTime::TimeZone; use Image::Size; use Moose; use namespace::clean -except => [ 'meta' ]; use Utils; +use RABX; with 'FixMyStreet::Roles::Abuser'; |