Bug 25655: DBIC schema
[srvgit] / 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 client_id
27
28   data_type: 'varchar'
29   is_nullable: 0
30   size: 191
31
32 API client ID
33
34 =head2 secret
35
36   data_type: 'varchar'
37   is_nullable: 0
38   size: 191
39
40 API client secret used for API authentication
41
42 =head2 description
43
44   data_type: 'varchar'
45   is_nullable: 0
46   size: 255
47
48 API client description
49
50 =head2 patron_id
51
52   data_type: 'integer'
53   is_foreign_key: 1
54   is_nullable: 0
55
56 Foreign key to the borrowers table
57
58 =head2 active
59
60   data_type: 'tinyint'
61   default_value: 1
62   is_nullable: 0
63
64 0 means this API key is revoked
65
66 =cut
67
68 __PACKAGE__->add_columns(
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   "patron_id",
76   { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
77   "active",
78   { data_type => "tinyint", default_value => 1, is_nullable => 0 },
79 );
80
81 =head1 PRIMARY KEY
82
83 =over 4
84
85 =item * L</client_id>
86
87 =back
88
89 =cut
90
91 __PACKAGE__->set_primary_key("client_id");
92
93 =head1 UNIQUE CONSTRAINTS
94
95 =head2 C<secret>
96
97 =over 4
98
99 =item * L</secret>
100
101 =back
102
103 =cut
104
105 __PACKAGE__->add_unique_constraint("secret", ["secret"]);
106
107 =head1 RELATIONS
108
109 =head2 patron
110
111 Type: belongs_to
112
113 Related object: L<Koha::Schema::Result::Borrower>
114
115 =cut
116
117 __PACKAGE__->belongs_to(
118   "patron",
119   "Koha::Schema::Result::Borrower",
120   { borrowernumber => "patron_id" },
121   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
122 );
123
124
125 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29
126 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2yvvoid4Taq7cjXFDuMoAA
127
128 __PACKAGE__->add_columns(
129     '+active' => { is_boolean => 1 }
130 );
131
132 # You can replace this text with custom code or comments, and it will be preserved on regeneration
133 1;