Bug 31212: DBIC schema
[koha.git] / Koha / Schema / Result / Review.pm
1 use utf8;
2 package Koha::Schema::Result::Review;
3
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
6
7 =head1 NAME
8
9 Koha::Schema::Result::Review
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<reviews>
19
20 =cut
21
22 __PACKAGE__->table("reviews");
23
24 =head1 ACCESSORS
25
26 =head2 reviewid
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 unique identifier for this comment
33
34 =head2 borrowernumber
35
36   data_type: 'integer'
37   is_foreign_key: 1
38   is_nullable: 1
39
40 foreign key from the borrowers table defining which patron left this comment
41
42 =head2 biblionumber
43
44   data_type: 'integer'
45   is_foreign_key: 1
46   is_nullable: 1
47
48 foreign key from the biblio table defining which bibliographic record this comment is for
49
50 =head2 review
51
52   data_type: 'mediumtext'
53   is_nullable: 1
54
55 the body of the comment
56
57 =head2 approved
58
59   data_type: 'tinyint'
60   default_value: 0
61   is_nullable: 1
62
63 whether this comment has been approved by a librarian (1 for yes, 0 for no)
64
65 =head2 datereviewed
66
67   data_type: 'datetime'
68   datetime_undef_if_invalid: 1
69   is_nullable: 1
70
71 the date the comment was left
72
73 =cut
74
75 __PACKAGE__->add_columns(
76   "reviewid",
77   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
78   "borrowernumber",
79   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
80   "biblionumber",
81   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
82   "review",
83   { data_type => "mediumtext", is_nullable => 1 },
84   "approved",
85   { data_type => "tinyint", default_value => 0, is_nullable => 1 },
86   "datereviewed",
87   {
88     data_type => "datetime",
89     datetime_undef_if_invalid => 1,
90     is_nullable => 1,
91   },
92 );
93
94 =head1 PRIMARY KEY
95
96 =over 4
97
98 =item * L</reviewid>
99
100 =back
101
102 =cut
103
104 __PACKAGE__->set_primary_key("reviewid");
105
106 =head1 RELATIONS
107
108 =head2 biblionumber
109
110 Type: belongs_to
111
112 Related object: L<Koha::Schema::Result::Biblio>
113
114 =cut
115
116 __PACKAGE__->belongs_to(
117   "biblionumber",
118   "Koha::Schema::Result::Biblio",
119   { biblionumber => "biblionumber" },
120   {
121     is_deferrable => 1,
122     join_type     => "LEFT",
123     on_delete     => "CASCADE",
124     on_update     => "CASCADE",
125   },
126 );
127
128 =head2 borrowernumber
129
130 Type: belongs_to
131
132 Related object: L<Koha::Schema::Result::Borrower>
133
134 =cut
135
136 __PACKAGE__->belongs_to(
137   "borrowernumber",
138   "Koha::Schema::Result::Borrower",
139   { borrowernumber => "borrowernumber" },
140   {
141     is_deferrable => 1,
142     join_type     => "LEFT",
143     on_delete     => "SET NULL",
144     on_update     => "CASCADE",
145   },
146 );
147
148
149 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29
150 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1Am1qqe4ETom7ylth3Tvpg
151
152
153 # You can replace this text with custom content, and it will be preserved on regeneration
154 1;