Summary: | Columns bookings.creation_date and bookings.modification_date not added if multiple databases are in use | ||
---|---|---|---|
Product: | Koha | Reporter: | Emmi Takkinen <emmi.takkinen> |
Component: | Database | Assignee: | Emmi Takkinen <emmi.takkinen> |
Status: | Pushed to stable --- | QA Contact: | Martin Renvoize (ashimema) <martin.renvoize> |
Severity: | blocker | ||
Priority: | P5 - low | CC: | david, jonathan.druart, martin.renvoize, paul.derscheid, wainuiwitikapark |
Version: | Main | Keywords: | additional_work_needed |
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This fixes the database update for Bug 37592 - Add a record of creation and modification to bookings, added in Koha 24.11.00. It covers the case where multiple Koha instances are being updated on the same server - the database update was only updating the first database.
|
Version(s) released in: |
25.05.00,24.11.01
|
Circulation function: | |||
Attachments: |
Bug 38602: Do not check if columns bookings.creation_date and bookings.modification_date from information_schema
Bug 38602: Do not check if columns bookings.creation_date and bookings.modification_date from information_schema Bug 38602: Do not check if columns bookings.creation_date and bookings.modification_date from information_schema |
Description
Emmi Takkinen
2024-12-03 10:59:01 UTC
Emmi, thanks for the report and detective work. Are you working on a patch by chance? I have updated the severity. Created attachment 175071 [details] [review] Bug 38602: Do not check if columns bookings.creation_date and bookings.modification_date from information_schema If one has multiple databases in use adding columns bookings.creation_date and bookings.modification_date is added just to first updated database and skipped in other updates. This happens because we check if these columns already exist in database from information_schema. We should instead make this check with method column_exists. To test: 1. Apply this patch. 3. Drop columns bookings.creation_date and bookings.modification_date: ALTER TABLE bookings DROP COLUMN creation_date; ALTER TABLE bookings DROP COLUMN modification_date; 2. Revert your database back to version 24.0600028: UPDATE systempreferences SET value = "24.0600014" WHERE variable = "version"; 3. Run updatedatabase.pl. => Check that columns were added. If you happen to have two databases: 1. Check if you have columns in your bookings table: SELECT DISTINCT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('creation_date', 'modification_date'); => Note that columns exist only in one of the databases. 2. Make sure you're using database missing columns from booking table. 3. Apply this patch. 4. Revert back to version 24.0600028. 5. Run updatedatabase.pl => Check that columns were now added to database. Sponsored-by: Koha-Suomi Oy Hopefully that test plan makes any sense :D Created attachment 175176 [details] [review] Bug 38602: Do not check if columns bookings.creation_date and bookings.modification_date from information_schema If one has multiple databases in use adding columns bookings.creation_date and bookings.modification_date is added just to first updated database and skipped in other updates. This happens because we check if these columns already exist in database from information_schema. We should instead make this check with method column_exists. To test: 1. Apply this patch. 3. Drop columns bookings.creation_date and bookings.modification_date: ALTER TABLE bookings DROP COLUMN creation_date; ALTER TABLE bookings DROP COLUMN modification_date; 2. Revert your database back to version 24.0600028: UPDATE systempreferences SET value = "24.0600014" WHERE variable = "version"; 3. Run updatedatabase.pl. => Check that columns were added. If you happen to have two databases: 1. Check if you have columns in your bookings table: SELECT DISTINCT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('creation_date', 'modification_date'); => Note that columns exist only in one of the databases. 2. Make sure you're using database missing columns from booking table. 3. Apply this patch. 4. Revert back to version 24.0600028. 5. Run updatedatabase.pl => Check that columns were now added to database. Sponsored-by: Koha-Suomi Oy Signed-off-by: David Nind <david@davidnind.com> Testing notes (using KTD): 1. I only have one database, so only tested that. Damn.. how on earth did I miss this during QA :'(. Thanks for the quick fix Emmi.. we really do need more people don't the QA team to share the load. Created attachment 175237 [details] [review] Bug 38602: Do not check if columns bookings.creation_date and bookings.modification_date from information_schema If one has multiple databases in use adding columns bookings.creation_date and bookings.modification_date is added just to first updated database and skipped in other updates. This happens because we check if these columns already exist in database from information_schema. We should instead make this check with method column_exists. To test: 1. Apply this patch. 3. Drop columns bookings.creation_date and bookings.modification_date: ALTER TABLE bookings DROP COLUMN creation_date; ALTER TABLE bookings DROP COLUMN modification_date; 2. Revert your database back to version 24.0600028: UPDATE systempreferences SET value = "24.0600014" WHERE variable = "version"; 3. Run updatedatabase.pl. => Check that columns were added. If you happen to have two databases: 1. Check if you have columns in your bookings table: SELECT DISTINCT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('creation_date', 'modification_date'); => Note that columns exist only in one of the databases. 2. Make sure you're using database missing columns from booking table. 3. Apply this patch. 4. Revert back to version 24.0600028. 5. Run updatedatabase.pl => Check that columns were now added to database. Sponsored-by: Koha-Suomi Oy Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Nice logical patch, thanks Emmi! I want to push this right away. Getting the question out there: should we add another database update to fix this for libraries that might have already installed 24.11.00? Pushed for 25.05! Well done everyone, thank you! Thanks for cleaning that up :) Nice work everyone! Pushed to 24.11.x for 24.11.01 I've had a go at adding a release note. However, I don't really understand how you would have "multiple databases are in use", which I would like to explain so that librarians could understand. Is this the case if you are updating multiple instances of Koha? Or something else? (In reply to David Nind from comment #13) > I've had a go at adding a release note. > > However, I don't really understand how you would have "multiple databases > are in use", which I would like to explain so that librarians could > understand. > > Is this the case if you are updating multiple instances of Koha? Or > something else? Yeah, basically it's a case of updating multiple instances which have databases installed in same mysql server. I should have probably explained it like this in my comments :D (In reply to Emmi Takkinen from comment #14) > (In reply to David Nind from comment #13) > > I've had a go at adding a release note. > > > > However, I don't really understand how you would have "multiple databases > > are in use", which I would like to explain so that librarians could > > understand. > > > > Is this the case if you are updating multiple instances of Koha? Or > > something else? > > Yeah, basically it's a case of updating multiple instances which have > databases installed in same mysql server. I should have probably explained > it like this in my comments :D Thanks Emmi! Not backporting to 24.05.x |