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.perl (+30 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
4
    unless( TableExists('configurations') ) {
5
        $dbh->do(q{
6
            CREATE TABLE `configurations` (
7
                `id` INT(11) NOT NULL AUTO_INCREMENT,
8
                `library_id` VARCHAR(10) NULL DEFAULT NULL,
9
                `category_id` VARCHAR(10) NULL DEFAULT NULL,
10
                `item_type` VARCHAR(10) NULL DEFAULT NULL,
11
                `name` VARCHAR(32) NOT NULL,
12
                `value` MEDIUMTEXT NULL DEFAULT NULL,
13
                `type` ENUM('text', 'boolean', 'integer') NOT NULL DEFAULT 'text',
14
                PRIMARY KEY (`id`),
15
                KEY `library_id_idx` (`library_id`),
16
                KEY `category_id_idx` (`category_id`),
17
                KEY `item_type_idx` (`item_type`),
18
                KEY `name_idx` (`name`),
19
                KEY `type_idx` (`type`),
20
                UNIQUE (`library_id`, `category_id`, `item_type`, `name`),
21
                CONSTRAINT `library_id_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
22
                CONSTRAINT `category_id_fk` FOREIGN KEY (`category_id`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
23
                CONSTRAINT `item_type_fk` FOREIGN KEY (`item_type`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
24
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
25
        });
26
    }
27
28
    # Always end with this (adjust the bug info)
29
    NewVersion( $DBversion, 26129, "Add a new 'configurations' table");
30
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +33 lines)
Lines 2002-2007 CREATE TABLE `columns_settings` ( Link Here
2002
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2002
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2003
/*!40101 SET character_set_client = @saved_cs_client */;
2003
/*!40101 SET character_set_client = @saved_cs_client */;
2004
2004
2005
--
2006
-- Table structure for table `configurations`
2007
--
2008
2009
DROP TABLE IF EXISTS `configurations`;
2010
CREATE TABLE `configurations` (
2011
    `id` INT(11) NOT NULL AUTO_INCREMENT,
2012
    -- Unique ID of the configuration entry
2013
    `library_id` VARCHAR(10) NULL DEFAULT NULL,
2014
    -- Internal identifier for the library the config applies to. NULL means global
2015
    `category_id` VARCHAR(10) NULL DEFAULT NULL,
2016
    -- Internal identifier for the category the config applies to. NULL means global
2017
    `item_type` VARCHAR(10) NULL DEFAULT NULL,
2018
    -- Internal identifier for the item type the config applies to. NULL means global
2019
    `name` VARCHAR(32) NOT NULL,
2020
    -- Configuration entry name
2021
    `value` MEDIUMTEXT NULL DEFAULT NULL,
2022
    -- Configuration entry value
2023
    `type` ENUM('text', 'boolean', 'integer') NOT NULL DEFAULT 'text',
2024
    -- Configuration entry type
2025
    PRIMARY KEY (`id`),
2026
    KEY `library_id_idx` (`library_id`),
2027
    KEY `category_id_idx` (`category_id`),
2028
    KEY `item_type_idx` (`item_type`),
2029
    KEY `name_idx` (`name`),
2030
    KEY `type_idx` (`type`),
2031
    UNIQUE (`library_id`, `category_id`, `item_type`, `name`),
2032
    CONSTRAINT `library_id_fk` FOREIGN KEY (`library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
2033
    CONSTRAINT `category_id_fk` FOREIGN KEY (`category_id`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE,
2034
    CONSTRAINT `item_type_fk` FOREIGN KEY (`item_type`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE
2035
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2036
2005
--
2037
--
2006
-- Table structure for table `course_instructors`
2038
-- Table structure for table `course_instructors`
2007
--
2039
--
Lines 5324-5329 CREATE TABLE `zebraqueue` ( Link Here
5324
  PRIMARY KEY (`id`),
5356
  PRIMARY KEY (`id`),
5325
  KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
5357
  KEY `zebraqueue_lookup` (`server`,`biblio_auth_number`,`operation`,`done`)
5326
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5358
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5359
5327
/*!40101 SET character_set_client = @saved_cs_client */;
5360
/*!40101 SET character_set_client = @saved_cs_client */;
5328
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
5361
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
5329
5362
5330
- 

Return to bug 26129