diff options
-rw-r--r-- | db/schema.sql | 3 | ||||
-rw-r--r-- | db/schema_0011-add_extra_to_contacts.sql | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Contact.pm | 25 |
3 files changed, 32 insertions, 2 deletions
diff --git a/db/schema.sql b/db/schema.sql index c3487cdc8..3ec3c6756 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -79,6 +79,9 @@ create table contacts ( whenedited timestamp not null, -- what the last change was for: author's notes note text not null + + -- extra fields required for open311 + extra text ); create unique index contacts_area_id_category_idx on contacts(area_id, category); diff --git a/db/schema_0011-add_extra_to_contacts.sql b/db/schema_0011-add_extra_to_contacts.sql new file mode 100644 index 000000000..fd6eae807 --- /dev/null +++ b/db/schema_0011-add_extra_to_contacts.sql @@ -0,0 +1,6 @@ +begin; + +ALTER TABLE contacts + ADD COLUMN extra TEXT; + +commit; diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm index 001fb4ac6..779ca9bc2 100644 --- a/perllib/FixMyStreet/DB/Result/Contact.pm +++ b/perllib/FixMyStreet/DB/Result/Contact.pm @@ -34,12 +34,33 @@ __PACKAGE__->add_columns( { data_type => "timestamp", is_nullable => 0 }, "note", { data_type => "text", is_nullable => 0 }, + "extra", + { data_type => "text", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->add_unique_constraint("contacts_area_id_category_idx", ["area_id", "category"]); +__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; + }, + } +); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-23 15:49:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BXGd4uk1ybC5RTKlInTr0w +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-08-01 10:07:59 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4y6yRz4rMN66pBpkzfJJhg 1; |