Bugzilla – Attachment 23776 Details for
Bug 11384
Koha should not use "ctid" as a column name
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11384: rename the collections_tracking.ctId column
Bug-11384-rename-the-collectionstrackingctId-colum.patch (text/plain), 3.24 KB, created by
Jonathan Druart
on 2013-12-23 10:25:19 UTC
(
hide
)
Description:
Bug 11384: rename the collections_tracking.ctId column
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-12-23 10:25:19 UTC
Size:
3.24 KB
patch
obsolete
>From f3eaa6fd30b8ddfd60b8c216589ca30c20d6947a Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmc@esilibrary.com> >Date: Wed, 11 Dec 2013 16:49:01 +0000 >Subject: [PATCH] Bug 11384: rename the collections_tracking.ctId column > >'ctId' as a column name conflicts with one of the system >columns that PostgreSQL uses for each table, and consequently >needs to be renamed to enable deploying the schema to a Pg >database. This patch makes this change. > >To test: > >[1] Apply the patch and run the SQL specified in the database > updated. >[2] Verify that the collections_tracking table no longer has > a ctId column, but now has collections_tracking_id. >[3] Verify that prove -v t/db_dependent/RotatingCollections.t > passes. >[4] Verify that installer/data/mysql/kohastructure.sql runs > cleanly in an empty database. > >This patch does not affect user-visible behavior given the fact >that the rotating collections feature is currently disabled. > >Signed-off-by: Galen Charlton <gmc@esilibrary.com> > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/RotatingCollections.pm | 2 +- > installer/data/mysql/kohastructure.sql | 4 ++-- > installer/data/mysql/updatedatabase.pl | 9 +++++++++ > 3 files changed, 12 insertions(+), 3 deletions(-) > >diff --git a/C4/RotatingCollections.pm b/C4/RotatingCollections.pm >index 09b5216..d6fad87 100644 >--- a/C4/RotatingCollections.pm >+++ b/C4/RotatingCollections.pm >@@ -326,7 +326,7 @@ sub AddItemToCollection { > my $dbh = C4::Context->dbh; > > my $sth; >- $sth = $dbh->prepare("INSERT INTO collections_tracking ( ctId, colId, itemnumber ) >+ $sth = $dbh->prepare("INSERT INTO collections_tracking ( collections_tracking_id, colId, itemnumber ) > VALUES ( NULL, ?, ? )"); > $sth->execute( $colId, $itemnumber ) or return ( 0, 3, $sth->errstr() ); > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 3c5d9b0..aba11b8 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -487,10 +487,10 @@ CREATE TABLE collections ( > -- > DROP TABLE IF EXISTS collections_tracking; > CREATE TABLE collections_tracking ( >- ctId integer(11) NOT NULL auto_increment, >+ collections_tracking_id integer(11) NOT NULL auto_increment, > colId integer(11) NOT NULL DEFAULT 0 comment 'collections.colId', > itemnumber integer(11) NOT NULL DEFAULT 0 comment 'items.itemnumber', >- PRIMARY KEY (ctId) >+ PRIMARY KEY (collections_tracking_id) > ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8; > > -- >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 78074f3..e032d49 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7853,6 +7853,15 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.15.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do(q{ >+ ALTER TABLE collections_tracking CHANGE ctId collections_tracking_id integer(11) NOT NULL auto_increment; >+ }); >+ print "Upgrade to $DBversion done (Bug 11384) - change name of collections_tracker.ctId column)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11384
:
23434
|
23435
|
23769
|
23770
| 23776 |
23777
|
25154