diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-06-03 19:14:55 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-06-03 19:14:55 +0100 |
commit | a9f1e35a56307472d59684d119750eee6af61025 (patch) | |
tree | d5e6e9706fe5aa717a195a4793bd03b9fdd84ca7 | |
parent | d07bd0a10d8507c3952f81dcd7fdb251bec164c0 (diff) |
Add alert_sent and alert_type to DBIx::Class.
-rwxr-xr-x | db/rerun_dbic_loader.pl | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Alert.pm | 16 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/AlertSent.pm | 38 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/AlertType.pm | 55 |
4 files changed, 107 insertions, 4 deletions
diff --git a/db/rerun_dbic_loader.pl b/db/rerun_dbic_loader.pl index 71efa5db5..82a9a5221 100755 --- a/db/rerun_dbic_loader.pl +++ b/db/rerun_dbic_loader.pl @@ -14,8 +14,6 @@ use DBIx::Class::Schema::Loader qw/ make_schema_at /; # interested in my @tables_to_ignore = ( 'admin_log', # - 'alert_sent', # - 'alert_type', # 'debugdate', # 'flickr_imported', # 'partial_user', # diff --git a/perllib/FixMyStreet/DB/Result/Alert.pm b/perllib/FixMyStreet/DB/Result/Alert.pm index e0017b94d..b99c83a45 100644 --- a/perllib/FixMyStreet/DB/Result/Alert.pm +++ b/perllib/FixMyStreet/DB/Result/Alert.pm @@ -45,15 +45,27 @@ __PACKAGE__->add_columns( ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->belongs_to( + "alert_type", + "FixMyStreet::DB::Result::AlertType", + { ref => "alert_type" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); +__PACKAGE__->belongs_to( "user", "FixMyStreet::DB::Result::User", { id => "user_id" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); +__PACKAGE__->has_many( + "alert_sents", + "FixMyStreet::DB::Result::AlertSent", + { "foreign.alert_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-05-24 15:32:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MV8kPZiQVJH7coYT4FmXLg +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-03 16:48:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NlyhWyg0NrH5/kZYYO36qg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/AlertSent.pm b/perllib/FixMyStreet/DB/Result/AlertSent.pm new file mode 100644 index 000000000..85a9000d5 --- /dev/null +++ b/perllib/FixMyStreet/DB/Result/AlertSent.pm @@ -0,0 +1,38 @@ +package FixMyStreet::DB::Result::AlertSent; + +# 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__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->table("alert_sent"); +__PACKAGE__->add_columns( + "alert_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "parameter", + { data_type => "text", is_nullable => 1 }, + "whenqueued", + { + data_type => "timestamp", + default_value => \"ms_current_timestamp()", + is_nullable => 0, + }, +); +__PACKAGE__->belongs_to( + "alert", + "FixMyStreet::DB::Result::Alert", + { id => "alert_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-03 16:48:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:x1nMIiNFSTKxdPxZmko18Q + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/perllib/FixMyStreet/DB/Result/AlertType.pm b/perllib/FixMyStreet/DB/Result/AlertType.pm new file mode 100644 index 000000000..7a3cd1e36 --- /dev/null +++ b/perllib/FixMyStreet/DB/Result/AlertType.pm @@ -0,0 +1,55 @@ +package FixMyStreet::DB::Result::AlertType; + +# 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__->load_components("FilterColumn", "InflateColumn::DateTime"); +__PACKAGE__->table("alert_type"); +__PACKAGE__->add_columns( + "ref", + { data_type => "text", is_nullable => 0 }, + "head_sql_query", + { data_type => "text", is_nullable => 0 }, + "head_table", + { data_type => "text", is_nullable => 0 }, + "head_title", + { data_type => "text", is_nullable => 0 }, + "head_link", + { data_type => "text", is_nullable => 0 }, + "head_description", + { data_type => "text", is_nullable => 0 }, + "item_table", + { data_type => "text", is_nullable => 0 }, + "item_where", + { data_type => "text", is_nullable => 0 }, + "item_order", + { data_type => "text", is_nullable => 0 }, + "item_title", + { data_type => "text", is_nullable => 0 }, + "item_link", + { data_type => "text", is_nullable => 0 }, + "item_description", + { data_type => "text", is_nullable => 0 }, + "template", + { data_type => "text", is_nullable => 0 }, +); +__PACKAGE__->set_primary_key("ref"); +__PACKAGE__->has_many( + "alerts", + "FixMyStreet::DB::Result::Alert", + { "foreign.alert_type" => "self.ref" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-06-03 16:48:36 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KNZ7eWU/VgF8xzsjCHKVjw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; |