Summary: | Add ColumnExists method | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Component: | Architecture, internals, and plumbing | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
Status: | RESOLVED DUPLICATE | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | josef.moravec |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Bug Depends on: | |||
Bug Blocks: | 22155 | ||
Attachments: | Bug 22159: Add ColumnExists method |
Description
Tomás Cohen Arazi (tcohen)
2019-01-18 01:40:37 UTC
Created attachment 84174 [details] [review] 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 Tomás, why do we need this? We have column_exists defined in C4/Installer.pm and it could be used in atomic updates... (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 *** |