[Bug 22159] New: Add ColumnExists method
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22159 Bug ID: 22159 Summary: Add ColumnExists method Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- It would be handy to have a method to check if a column exists on a table. This is specially useful when rmaints backport changes to the DB structure. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22159 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22159 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |22155 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22155 [Bug 22155] biblio_metadata.marcflavour should be renamed 'schema' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22159 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 84174 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=84174&action=edit Bug 22159: Add ColumnExists method This patch adds a method for checking if a column exists on a DB table. The way this is checked is used already on updatedatabase.pl [1] (i.e. querying INFORMATION_SCHEMA. To test: - Create an atomicupdate file like this: $ cd installer/data/mysql/atomicupdate $ cp skeleton.perl test.perl - Change the contents of test.perl so it looks like this: $DBversion = 'XXX'; if( CheckVersion( $DBversion ) ) { if ( ColumnExists( 'borrowers', 'firstname' ) ) { print "Column borrowers.firstname exists!"; } else { print "Boo, borrowers.firstname wasn't detected"; } if ( ColumnExists( 'borrowers', 'friendly_alias' ) ) { print "Great, there's no borrowers.firend_alias"; } else { print "Boo, this is really wrong"; } } - Run: $ updatedatabase or $ kshell k$ perl installer/data/mysql/updatedatabase.pl => SUCCESS: No 'Boo' message is printed - Sign off :-D [1] See 3.03.00.023 or 18.12.00.002 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22159 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22159 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |josef.moravec@gmail.com --- Comment #2 from Josef Moravec <josef.moravec@gmail.com> --- Tomás, why do we need this? We have column_exists defined in C4/Installer.pm and it could be used in atomic updates... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22159 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |RESOLVED Resolution|--- |DUPLICATE --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Josef Moravec from comment #2)
Tomás, why do we need this? We have column_exists defined in C4/Installer.pm and it could be used in atomic updates...
LOL. This is because I failed to find it yesterday =D *** This bug has been marked as a duplicate of bug 17234 *** -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org