diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-12-12 16:48:27 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-12-15 00:11:05 +0000 |
commit | fa4947c017af7599699892c1c3a647fc61f971ed (patch) | |
tree | 71cf677abe1891f40a79fa2a1e606929ad8f7640 /perllib/FixMyStreet/DB/Result/Contact.pm | |
parent | 07b07d90cf666a06cb071ceebcecbd21d91e6b60 (diff) |
Rename area_id on Contacts table to body_id.
Add foreign key constraint from contacts to body.
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Contact.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Contact.pm | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm index 0fef2f56b..b9bfd8610 100644 --- a/perllib/FixMyStreet/DB/Result/Contact.pm +++ b/perllib/FixMyStreet/DB/Result/Contact.pm @@ -18,8 +18,8 @@ __PACKAGE__->add_columns( is_nullable => 0, sequence => "contacts_id_seq", }, - "area_id", - { data_type => "integer", is_nullable => 0 }, + "body_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, "category", { data_type => "text", default_value => "Other", is_nullable => 0 }, "email", @@ -48,11 +48,17 @@ __PACKAGE__->add_columns( { data_type => "text", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); -__PACKAGE__->add_unique_constraint("contacts_area_id_category_idx", ["area_id", "category"]); +__PACKAGE__->add_unique_constraint("contacts_body_id_category_idx", ["body_id", "category"]); +__PACKAGE__->belongs_to( + "body", + "FixMyStreet::DB::Result::Body", + { id => "body_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); -# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-12-10 15:33:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T1jcv40rbTqZbwDziGTYCA +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-12-13 12:34:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:imXq3EtrC0FrQwj+E2xfBw __PACKAGE__->filter_column( extra => { |