Preventing:
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Duplicate entry 'ActionLogsTraceDepth' for key 'PRIMARY' at /usr/share/koha/C4/Installer.pm line 739
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
As there is no check, this dbrev could cause trouble if run twice. It
doesn't look like it is going to get backported to 22.05, but just in
case...
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Fix MySQL error:
ERROR 1093 (HY000): You can't specify target table 'systempreferences' for
update in FROM clause
introduced by db_rev 064 for bug 14783.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Some users have reported that the dbrev of bug 30483 fails. This might
depend on bad data, SQL server version, etc.
We now remove the constraints temporarily.
Test plan:
Reset your version in order to pass this dbrev again. So below
22.06.00.041.
* update systempreferences set value='22.0600040' where variable = 'Version';
Run updatedatabase.
Bonus: Create an issues record with invalid itemnumber (set FK check
off when doing so). Verify that dbrev fails and installer stops.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
When e- is used as prefix, the second word should not
be capitalized. And when e-resource-management is used
as part of a sentence, the e shouldn't be either.
See: e-mail, e-commerce. etc.
To test:
* Best to check the code... but:
* All E-Resource should now read e-resource or E-resource, as on:
* Koha start page
* Breadcrumbs in the ERM module
* Descriptions of AV categories...
I chose to update the sysprefs.sql and the DB update as well
as this hasn't been released yet.
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Bug 32147: (follow-up) Fix missing space
One of the AV category descriptions was missing a space
before the (e-resource management).
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Without this patch, the update process duplicates all the news and
content entries when they were non-english to start with.
This patch keeps the same process, but new "default" "parent" entries are empty so there'
no duplication in the OPAC display, while still being editable/deletable
in the intranet.
We came through that through many iterations. This was the least
invasive while still providing satisfying results.
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Both updates now rely on 'suspension_chargeperiod' as the source of truth
for existence of a rule. Spot checking some existing production databases this
seems to be acceptable.
This alters the update to only add rules where a 'suspension_chargeperiod' rule exists
and a value for the rule is not already set.
NOTE: While the table has a unique key:
UNIQUE KEY `branchcode` (`branchcode`,`categorycode`,`itemtype`,`rule_name`),
This key doesn't prevent duplicates on NULLs, i.e.:
branchcode | categorycode | itemtype | rule_name | rule_value
NULL | NULL | BK | unseen_renewals_allowed | 1
NULL | NULL | BK | unseen_renewals_allowed | 2
NULL | NULL | BK | unseen_renewals_allowed | 3
So we need to both check that any rule is present and that the specific rule is not.
The 'INSERT IGNORE' won't IGNORE existing values except for the most specific rules
Test plan:
0 - Edit and save existing default rule in DB (sample data does not include suspension_chargeperiod)
1 - Set some rules for "Default checkout, hold and return policy" for "Standard rule" and some specific libraries
2 - cp installer/data/mysql/db_revs/220600024.pl installer/data/mysql/atomicupdate/
3 - SELECT * FROM circulation rules, note the number of rules that exist
4 - updatedatabase
5 - Check the DB again, you should now have rules as described in the bug
i.e. You will have 5 new rules per 'Default checkout, hold and return policy'
6 - apply 1st patch on bug
7 - rm installer/data/mysql/atomicupdate/220600024.pl (so we don't add again)
8 - updatedatabase
9 - Check DB, the extra rules have been deleted
10 - Apply 2nd patch
11 - cp installer/data/mysql/db_revs/220600024.pl installer/data/mysql/atomicupdate/
12 - rm installer/data/mysql/atomicupdate/bug_31727.pl (so we can confirm update isn't adding rules)
13 - updatedatabase
14 - Confirm no change in rules since step 9
15 - git reset --hard (get deleted update back)
16 - rm installer/data/mysql/atomicupdate/220600024.pl
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Bad data occurs. We are removing null hosts here and update
empty syntax or encoding, informing the user.
Test plan:
Remove the NOT NULL condition if needed.
Copy db_revs/220600056.pl to atomicupdate and test dbrev.
You might see something like:
Upgrade to 22.06.00.056 [11:48:22]: Bug 30571 - Table z3950servers: three cols NOT NULL
Found bad data in table z3950servers: removed 1 records with host undefined
Corrected empty syntax or encoding for the following hosts. Please check after upgrade.
Updated hosts: lx2.loc.gov,lx2.loc.gov
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
It seems that we cannot edit the column while it has a constraint.
If we remove it, update the oclumn, then re-add it, the update succeeds
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
As this has not been released yet, we can also fix the database
update to not introduce the wrong capitalization in the first
place.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This is a mix of Nick's patch and Jonathan's comment on it. I tested it
with KTD using MySQL 8 and it works correctly.
To test:
1. Launch KTD with bells and whistles:
$ docker compose -f docker-compose.yml \
-f docker-compose.mysql8.0.yml \
up -d
2. Inside of it, do:
$ koha-mysql kohadev
> update systempreferences set value="21.1200015" where variable="version";
> \q
$ restart_all
$ updatedatabase
=> SUCCESS: All good :-D
3. Run:
$ koha-mysql kohadev
> update systempreferences set value="21.1200015" where variable="version";
> ALTER TABLE user_permissions DROP PRIMARY KEY;
> \q
$ updatedatabase
=> FAIL: You get:
Upgrade to 21.12.00.016 [12:47:09]: Bug 30060 - Update user_permissions to add primary key and remove null option from code column
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS `PRIMARY`' at line 1 at /kohadevbox/koha/C4/Installer.pm line 739
4. Apply this patch
5. Run:
$ updatedatabase
=> SUCCESS: Update goes well
6. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Replace DROP CONSTRAINT by DROP FOREIGN KEY.
Note: It seems that we do not need a new dbrev for master. A developer
could follow test plan below to correct if really needed.
Test plan:
NOTE: When you check show create table, verify that you see an index for category_code and a foreign key called borrower_attribute_types_ibfk_1.
[1] cp installer/data/mysql/db_revs/211200041.pl installer/data/mysql/atomicupdate/
[2] run updatedatabase; check show create table
[3] alter table borrower_attribute_types drop foreign key borrower_attribute_types_ibfk_1; alter table borrower_attribute_types drop index category_code; RUN updatedatabase again; check show create table
[4] alter table borrower_attribute_types drop foreign key borrower_attribute_types_ibfk_1; ALTER TABLE borrower_attribute_types ADD CONSTRAINT category_code_fk FOREIGN KEY (category_code) REFERENCES categories(categorycode); RUN updatedatabase again; check show create table
[5] rm installer/data/atomicupdate/211200041.pl
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
The road of excess
leads to the palace of wisdom;
for we never know what is enough
until we know what is more than enough.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>