Bug 20568: Add mandatory description field for api keys
[koha.git] / Koha / Schema / Result / ApiKey.pm
1 use utf8;
2 package Koha::Schema::Result::ApiKey;
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::ApiKey
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<api_keys>
19
20 =cut
21
22 __PACKAGE__->table("api_keys");
23
24 =head1 ACCESSORS
25
26 =head2 id
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 =head2 patron_id
33
34   data_type: 'integer'
35   is_foreign_key: 1
36   is_nullable: 0
37
38 =head2 client_id
39
40   data_type: 'varchar'
41   is_nullable: 0
42   size: 191
43
44 =head2 secret
45
46   data_type: 'varchar'
47   is_nullable: 0
48   size: 191
49
50 =head2 description
51
52   data_type: 'varchar'
53   is_nullable: 0
54   size: 255
55
56 =head2 active
57
58   data_type: 'tinyint'
59   default_value: 1
60   is_nullable: 0
61
62 =cut
63
64 __PACKAGE__->add_columns(
65   "id",
66   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
67   "patron_id",
68   { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
69   "client_id",
70   { data_type => "varchar", is_nullable => 0, size => 191 },
71   "secret",
72   { data_type => "varchar", is_nullable => 0, size => 191 },
73   "description",
74   { data_type => "varchar", is_nullable => 0, size => 255 },
75   "active",
76   { data_type => "tinyint", default_value => 1, is_nullable => 0 },
77 );
78
79 =head1 PRIMARY KEY
80
81 =over 4
82
83 =item * L</id>
84
85 =back
86
87 =cut
88
89 __PACKAGE__->set_primary_key("id");
90
91 =head1 UNIQUE CONSTRAINTS
92
93 =head2 C<client_id>
94
95 =over 4
96
97 =item * L</client_id>
98
99 =back
100
101 =cut
102
103 __PACKAGE__->add_unique_constraint("client_id", ["client_id"]);
104
105 =head2 C<secret>
106
107 =over 4
108
109 =item * L</secret>
110
111 =back
112
113 =cut
114
115 __PACKAGE__->add_unique_constraint("secret", ["secret"]);
116
117 =head1 RELATIONS
118
119 =head2 patron
120
121 Type: belongs_to
122
123 Related object: L<Koha::Schema::Result::Borrower>
124
125 =cut
126
127 __PACKAGE__->belongs_to(
128   "patron",
129   "Koha::Schema::Result::Borrower",
130   { borrowernumber => "patron_id" },
131   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
132 );
133
134
135 # Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-04-14 00:56:23
136 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:b7AUAgl2SClXJ2lzPVV0FA
137
138 __PACKAGE__->add_columns(
139     '+active' => { is_boolean => 1 }
140 );
141
142 # You can replace this text with custom code or comments, and it will be preserved on regeneration
143 1;