View | Details | Raw Unified | Return to bug 26129
Collapse All | Expand All

(-)a/Koha/Schema/Result/Configuration.pm (+198 lines)
Line 0 Link Here
1
use utf8;
2
package Koha::Schema::Result::Configuration;
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::Configuration
10
11
=cut
12
13
use strict;
14
use warnings;
15
16
use base 'DBIx::Class::Core';
17
18
=head1 TABLE: C<configurations>
19
20
=cut
21
22
__PACKAGE__->table("configurations");
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 library_id
33
34
  data_type: 'varchar'
35
  is_foreign_key: 1
36
  is_nullable: 1
37
  size: 10
38
39
=head2 category_id
40
41
  data_type: 'varchar'
42
  is_foreign_key: 1
43
  is_nullable: 1
44
  size: 10
45
46
=head2 item_type
47
48
  data_type: 'varchar'
49
  is_foreign_key: 1
50
  is_nullable: 1
51
  size: 10
52
53
=head2 name
54
55
  data_type: 'varchar'
56
  is_nullable: 0
57
  size: 32
58
59
=head2 value
60
61
  data_type: 'mediumtext'
62
  is_nullable: 1
63
64
=head2 type
65
66
  data_type: 'enum'
67
  default_value: 'text'
68
  extra: {list => ["text","boolean","integer"]}
69
  is_nullable: 0
70
71
=cut
72
73
__PACKAGE__->add_columns(
74
  "id",
75
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
76
  "library_id",
77
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
78
  "category_id",
79
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
80
  "item_type",
81
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
82
  "name",
83
  { data_type => "varchar", is_nullable => 0, size => 32 },
84
  "value",
85
  { data_type => "mediumtext", is_nullable => 1 },
86
  "type",
87
  {
88
    data_type => "enum",
89
    default_value => "text",
90
    extra => { list => ["text", "boolean", "integer"] },
91
    is_nullable => 0,
92
  },
93
);
94
95
=head1 PRIMARY KEY
96
97
=over 4
98
99
=item * L</id>
100
101
=back
102
103
=cut
104
105
__PACKAGE__->set_primary_key("id");
106
107
=head1 UNIQUE CONSTRAINTS
108
109
=head2 C<library_id>
110
111
=over 4
112
113
=item * L</library_id>
114
115
=item * L</category_id>
116
117
=item * L</item_type>
118
119
=item * L</name>
120
121
=back
122
123
=cut
124
125
__PACKAGE__->add_unique_constraint(
126
  "library_id",
127
  ["library_id", "category_id", "item_type", "name"],
128
);
129
130
=head1 RELATIONS
131
132
=head2 category
133
134
Type: belongs_to
135
136
Related object: L<Koha::Schema::Result::Category>
137
138
=cut
139
140
__PACKAGE__->belongs_to(
141
  "category",
142
  "Koha::Schema::Result::Category",
143
  { categorycode => "category_id" },
144
  {
145
    is_deferrable => 1,
146
    join_type     => "LEFT",
147
    on_delete     => "CASCADE",
148
    on_update     => "CASCADE",
149
  },
150
);
151
152
=head2 item_type
153
154
Type: belongs_to
155
156
Related object: L<Koha::Schema::Result::Itemtype>
157
158
=cut
159
160
__PACKAGE__->belongs_to(
161
  "item_type",
162
  "Koha::Schema::Result::Itemtype",
163
  { itemtype => "item_type" },
164
  {
165
    is_deferrable => 1,
166
    join_type     => "LEFT",
167
    on_delete     => "CASCADE",
168
    on_update     => "CASCADE",
169
  },
170
);
171
172
=head2 library
173
174
Type: belongs_to
175
176
Related object: L<Koha::Schema::Result::Branch>
177
178
=cut
179
180
__PACKAGE__->belongs_to(
181
  "library",
182
  "Koha::Schema::Result::Branch",
183
  { branchcode => "library_id" },
184
  {
185
    is_deferrable => 1,
186
    join_type     => "LEFT",
187
    on_delete     => "CASCADE",
188
    on_update     => "CASCADE",
189
  },
190
);
191
192
193
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-08-03 17:21:00
194
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SCRluJvwzSovqN3pVW7omA
195
196
197
# You can replace this text with custom code or comments, and it will be preserved on regeneration
198
1;
(-)a/installer/data/mysql/atomicupdate/bug_26129_configurations_table.pl (+36 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "26129",
5
    description => "Add a new 'configurations' table",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ($dbh)  = @$args{qw(dbh out)};
9
10
        unless ( TableExists('configurations') ) {
11
            $dbh->do(
12
                q{
13
                CREATE TABLE `configurations` (
14
                    `id` INT(11) NOT NULL AUTO_INCREMENT,
15
                    `library_id` VARCHAR(10) NULL DEFAULT NULL,
16
                    `category_id` VARCHAR(10) NULL DEFAULT NULL,
17
                    `item_type` VARCHAR(10) NULL DEFAULT NULL,
18
                    `name` VARCHAR(32) NOT NULL,
19
                    `value` MEDIUMTEXT NULL DEFAULT NULL,
20
                    `type` ENUM('text', 'boolean', 'integer') NOT NULL DEFAULT 'text',
21
                    PRIMARY KEY (`id`),
22
                    KEY `library_id_idx` (`library_id`),
23
                    KEY `category_id_idx` (`category_id`),
24
                    KEY `item_type_idx` (`item_type`),
25
                    KEY `name_idx` (`name`),
26
                    KEY `type_idx` (`type`),
27
                    UNIQUE (`library_id`, `category_id`, `item_type`, `name`),
28
                    CONSTRAINT `library_id_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
29
                    CONSTRAINT `category_id_fk` FOREIGN KEY (`category_id`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
30
                    CONSTRAINT `item_type_fk` FOREIGN KEY (`item_type`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
31
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
32
            }
33
            );
34
        }
35
    },
36
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +33 lines)
Lines 2026-2031 CREATE TABLE `columns_settings` ( Link Here
2026
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2026
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2027
/*!40101 SET character_set_client = @saved_cs_client */;
2027
/*!40101 SET character_set_client = @saved_cs_client */;
2028
2028
2029
--
2030
-- Table structure for table `configurations`
2031
--
2032
2033
DROP TABLE IF EXISTS `configurations`;
2034
CREATE TABLE `configurations` (
2035
    `id` INT(11) NOT NULL AUTO_INCREMENT,
2036
    -- Unique ID of the configuration entry
2037
    `library_id` VARCHAR(10) NULL DEFAULT NULL,
2038
    -- Internal identifier for the library the config applies to. NULL means global
2039
    `category_id` VARCHAR(10) NULL DEFAULT NULL,
2040
    -- Internal identifier for the category the config applies to. NULL means global
2041
    `item_type` VARCHAR(10) NULL DEFAULT NULL,
2042
    -- Internal identifier for the item type the config applies to. NULL means global
2043
    `name` VARCHAR(32) NOT NULL,
2044
    -- Configuration entry name
2045
    `value` MEDIUMTEXT NULL DEFAULT NULL,
2046
    -- Configuration entry value
2047
    `type` ENUM('text', 'boolean', 'integer') NOT NULL DEFAULT 'text',
2048
    -- Configuration entry type
2049
    PRIMARY KEY (`id`),
2050
    KEY `library_id_idx` (`library_id`),
2051
    KEY `category_id_idx` (`category_id`),
2052
    KEY `item_type_idx` (`item_type`),
2053
    KEY `name_idx` (`name`),
2054
    KEY `type_idx` (`type`),
2055
    UNIQUE (`library_id`, `category_id`, `item_type`, `name`),
2056
    CONSTRAINT `library_id_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2057
    CONSTRAINT `category_id_fk` FOREIGN KEY (`category_id`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
2058
    CONSTRAINT `item_type_fk` FOREIGN KEY (`item_type`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
2059
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2060
2029
--
2061
--
2030
-- Table structure for table `course_instructors`
2062
-- Table structure for table `course_instructors`
2031
--
2063
--
Lines 5355-5360 CREATE TABLE `zebraqueue` ( Link Here
5355
  PRIMARY KEY (`id`),
5387
  PRIMARY KEY (`id`),
5356
  KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
5388
  KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
5357
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5389
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5390
5358
/*!40101 SET character_set_client = @saved_cs_client */;
5391
/*!40101 SET character_set_client = @saved_cs_client */;
5359
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
5392
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
5360
5393
5361
- 

Return to bug 26129