]>
Commit | Line | Data |
---|---|---|
1 | use utf8; | |
2 | package 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 | ||
9 | Gruntmaster::Data::Result::Open | |
10 | ||
11 | =head1 DESCRIPTION | |
12 | ||
13 | List of (contest, problem, user, time when user opened problem) | |
14 | ||
15 | =cut | |
16 | ||
17 | use strict; | |
18 | use warnings; | |
19 | ||
20 | use 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 | ||
86 | Type: belongs_to | |
87 | ||
88 | Related object: L<Gruntmaster::Data::Result::Contest> | |
89 | ||
90 | =cut | |
91 | ||
92 | __PACKAGE__->belongs_to( | |
93 | "contest", | |
94 | "Gruntmaster::Data::Result::Contest", | |
95 | { id => "contest" }, | |
96 | { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, | |
97 | ); | |
98 | ||
99 | =head2 owner | |
100 | ||
101 | Type: belongs_to | |
102 | ||
103 | Related object: L<Gruntmaster::Data::Result::User> | |
104 | ||
105 | =cut | |
106 | ||
107 | __PACKAGE__->belongs_to( | |
108 | "owner", | |
109 | "Gruntmaster::Data::Result::User", | |
110 | { id => "owner" }, | |
111 | { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, | |
112 | ); | |
113 | ||
114 | =head2 problem | |
115 | ||
116 | Type: belongs_to | |
117 | ||
118 | Related object: L<Gruntmaster::Data::Result::Problem> | |
119 | ||
120 | =cut | |
121 | ||
122 | __PACKAGE__->belongs_to( | |
123 | "problem", | |
124 | "Gruntmaster::Data::Result::Problem", | |
125 | { id => "problem" }, | |
126 | { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, | |
127 | ); | |
128 | ||
129 | ||
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 | |
132 | ||
133 | use Class::Method::Modifiers qw/after/; | |
134 | ||
135 | sub rawcontest { shift->get_column('contest') } | |
136 | sub rawowner { shift->get_column('owner') } | |
137 | sub rawproblem { shift->get_column('problem') } | |
138 | ||
139 | after qw/insert update delete/ => sub { | |
140 | my ($self) = @_; | |
141 | Gruntmaster::Data::purge '/st/' . $self->rawcontest; | |
142 | }; | |
143 | ||
144 | 1; | |
145 | ||
146 | __END__ | |
147 | ||
148 | =head1 AUTHOR | |
149 | ||
150 | Marius Gavrilescu E<lt>marius@ieval.roE<gt> | |
151 | ||
152 | =head1 COPYRIGHT AND LICENSE | |
153 | ||
154 | Copyright (C) 2014 by Marius Gavrilescu | |
155 | ||
156 | This library is free software; you can redistribute it and/or modify | |
157 | it under the same terms as Perl itself, either Perl version 5.18.1 or, | |
158 | at your option, any later version of Perl 5 you may have available. | |
159 | ||
160 | ||
161 | =cut |