Purge affected pages on insert/update/delete
[gruntmaster-data.git] / lib / Gruntmaster / Data / Result / Open.pm
CommitLineData
4ed3f8e7
MG
1use utf8;
2package Gruntmaster::Data::Result::Open;
3
4# Created by DBIx::Class::Schema::Loader
5# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7=head1 NAME
8
9Gruntmaster::Data::Result::Open
10
be2f7678
MG
11=head1 DESCRIPTION
12
13List of (contest, problem, user, time when user opened problem)
14
4ed3f8e7
MG
15=cut
16
17use strict;
18use warnings;
19
20use base 'DBIx::Class::Core';
21
22=head1 TABLE: C<opens>
23
24=cut
25
26__PACKAGE__->table("opens");
27
28=head1 ACCESSORS
29
30=head2 contest
31
32 data_type: 'text'
33 is_foreign_key: 1
34 is_nullable: 0
35
36=head2 problem
37
38 data_type: 'text'
39 is_foreign_key: 1
40 is_nullable: 0
41
42=head2 owner
43
44 data_type: 'text'
45 is_foreign_key: 1
46 is_nullable: 0
47
48=head2 time
49
50 data_type: 'bigint'
51 is_nullable: 0
52
53=cut
54
55__PACKAGE__->add_columns(
56 "contest",
57 { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
58 "problem",
59 { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
60 "owner",
61 { data_type => "text", is_foreign_key => 1, is_nullable => 0 },
62 "time",
63 { data_type => "bigint", is_nullable => 0 },
64);
65
66=head1 PRIMARY KEY
67
68=over 4
69
70=item * L</contest>
71
72=item * L</problem>
73
74=item * L</owner>
75
76=back
77
78=cut
79
80__PACKAGE__->set_primary_key("contest", "problem", "owner");
81
82=head1 RELATIONS
83
84=head2 contest
85
86Type: belongs_to
87
88Related object: L<Gruntmaster::Data::Result::Contest>
89
90=cut
91
92__PACKAGE__->belongs_to(
93 "contest",
94 "Gruntmaster::Data::Result::Contest",
95 { id => "contest" },
9bb39921 96 { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
4ed3f8e7
MG
97);
98
99=head2 owner
100
101Type: belongs_to
102
103Related object: L<Gruntmaster::Data::Result::User>
104
105=cut
106
107__PACKAGE__->belongs_to(
108 "owner",
109 "Gruntmaster::Data::Result::User",
110 { id => "owner" },
9bb39921 111 { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
4ed3f8e7
MG
112);
113
114=head2 problem
115
116Type: belongs_to
117
118Related object: L<Gruntmaster::Data::Result::Problem>
119
120=cut
121
122__PACKAGE__->belongs_to(
123 "problem",
124 "Gruntmaster::Data::Result::Problem",
125 { id => "problem" },
9bb39921 126 { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" },
4ed3f8e7
MG
127);
128
129
be2f7678
MG
130# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-12-19 16:44:22
131# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jAao0vjOW87mO37ZQhm4Cw
4ed3f8e7 132
de7226ca
MG
133use Class::Method::Modifiers qw/after/;
134
135sub rawcontest { shift->get_column('contest') }
a2aa46e6
MG
136sub rawowner { shift->get_column('owner') }
137sub rawproblem { shift->get_column('problem') }
4ed3f8e7 138
de7226ca
MG
139after qw/insert update delete/ => sub {
140 my ($self) = @_;
141 Gruntmaster::Data::purge '/st/' . $self->rawcontest;
142};
143
4ed3f8e7 1441;
4a8747ef
MG
145
146__END__
147
148=head1 AUTHOR
149
150Marius Gavrilescu E<lt>marius@ieval.roE<gt>
151
152=head1 COPYRIGHT AND LICENSE
153
154Copyright (C) 2014 by Marius Gavrilescu
155
156This library is free software; you can redistribute it and/or modify
157it under the same terms as Perl itself, either Perl version 5.18.1 or,
158at your option, any later version of Perl 5 you may have available.
159
160
161=cut
This page took 0.020904 seconds and 4 git commands to generate.