aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-03-21 16:29:48 +0000
committerEdmund von der Burg <evdb@mysociety.org>2011-03-21 16:29:48 +0000
commitc8bea71a64db62236819d173a0b2613d7195356f (patch)
tree027f8abf3ccb77e9113fd2943876821817c15332
parentf395fedf2ee8b2d0eb0d3e525b39bdec82b82bc1 (diff)
Add contacts table to DBIC schema
-rwxr-xr-xdb/rerun_dbic_loader.pl1
-rw-r--r--perllib/FixMyStreet/DB/Result/Contact.pm44
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Contact.pm20
3 files changed, 64 insertions, 1 deletions
diff --git a/db/rerun_dbic_loader.pl b/db/rerun_dbic_loader.pl
index 7a3f41503..9d94c2b8b 100755
--- a/db/rerun_dbic_loader.pl
+++ b/db/rerun_dbic_loader.pl
@@ -19,7 +19,6 @@ my @tables_to_ignore = (
'alert_sent', #
'alert_type', #
'comment', #
- 'contacts', #
'contacts_history', #
'debugdate', #
'flickr_imported', #
diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm
new file mode 100644
index 000000000..dd5d1f579
--- /dev/null
+++ b/perllib/FixMyStreet/DB/Result/Contact.pm
@@ -0,0 +1,44 @@
+package FixMyStreet::DB::Result::Contact;
+
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+__PACKAGE__->table("contacts");
+__PACKAGE__->add_columns(
+ "area_id",
+ { data_type => "integer", is_nullable => 0 },
+ "category",
+ { data_type => "text", default_value => "Other", is_nullable => 0 },
+ "email",
+ { data_type => "text", is_nullable => 0 },
+ "confirmed",
+ { data_type => "boolean", is_nullable => 0 },
+ "deleted",
+ { data_type => "boolean", is_nullable => 0 },
+ "editor",
+ { data_type => "text", is_nullable => 0 },
+ "whenedited",
+ { data_type => "timestamp", is_nullable => 0 },
+ "note",
+ { data_type => "text", is_nullable => 0 },
+ "id",
+ {
+ data_type => "integer",
+ is_auto_increment => 1,
+ is_nullable => 0,
+ sequence => "contacts_id_seq",
+ },
+);
+__PACKAGE__->set_primary_key("id");
+__PACKAGE__->add_unique_constraint( "contacts_area_id_category_idx",
+ [ "area_id", "category" ] );
+
+# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-03-21 16:25:05
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zuvUDlmZI74jTjrSCb1RTQ
+
+1;
diff --git a/perllib/FixMyStreet/DB/ResultSet/Contact.pm b/perllib/FixMyStreet/DB/ResultSet/Contact.pm
new file mode 100644
index 000000000..52ff498a6
--- /dev/null
+++ b/perllib/FixMyStreet/DB/ResultSet/Contact.pm
@@ -0,0 +1,20 @@
+package FixMyStreet::DB::ResultSet::Contact;
+use base 'DBIx::Class::ResultSet';
+
+use strict;
+use warnings;
+
+=head2 not_deleted
+
+ $rs = $rs->not_deleted();
+
+Filter down to not deleted contacts - which have C<deleted> set to false;
+
+=cut
+
+sub not_deleted {
+ my $rs = shift;
+ return $rs->search( { deleted => 0 } );
+}
+
+1;