[Koha-devel] Migrate/Upgrade from 2.2.3 to latest.

Michael Hafen michael.hafen at washk12.org
Tue Sep 13 19:33:45 CEST 2016


I think the problem there is that the code column is declared as 'DEFAULT
NULL', where in the permissions table it is declared as 'NOT NULL'.  And
the foreign key constraints require an index, as I recall.  It seems that
since no primary key is declared it's trying to make one using all the
columns, but can't because of the code column.  I think if you change the
code column declaration to match how it's declared in the permissions table
that will fix the query.

On Tue, Sep 13, 2016 at 9:34 AM, Rodrigo Santellan <rsantellan at gmail.com>
wrote:

> I found out that on the upgrade 3.00.00.068 the script for creating the
> table permissions is wrong:
>
> DBD::mysql::db do failed: All parts of a PRIMARY KEY must be NOT NULL; if
> you need NULL in a key, use UNIQUE instead [for Statement "CREATE TABLE
> `permissions` (
>                 `module_bit` int(11) NOT NULL DEFAULT 0,
>                 `code` varchar(30) DEFAULT NULL,
>                 `description` varchar(255) DEFAULT NULL,
>                 PRIMARY KEY  (`module_bit`, `code`),
>                 CONSTRAINT `permissions_ibfk_1` FOREIGN KEY (`module_bit`)
> REFERENCES `userflags` (`bit`)
>                     ON DELETE CASCADE ON UPDATE CASCADE
>               ) ENGINE=InnoDB DEFAULT CHARSET=utf8"] at updatedatabase.pl
> line 1273.
> DBD::mysql::db do failed: Cannot add foreign key constraint [for Statement
> "CREATE TABLE `user_permissions` (
>                 `borrowernumber` int(11) NOT NULL DEFAULT 0,
>                 `module_bit` int(11) NOT NULL DEFAULT 0,
>                 `code` varchar(30) DEFAULT NULL,
>                 CONSTRAINT `user_permissions_ibfk_1` FOREIGN KEY
> (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`)
>                     ON DELETE CASCADE ON UPDATE CASCADE,
>                 CONSTRAINT `user_permissions_ibfk_2` FOREIGN KEY
> (`module_bit`, `code`)
>                     REFERENCES `permissions` (`module_bit`, `code`)
>                     ON DELETE CASCADE ON UPDATE CASCADE
>               ) ENGINE=InnoDB DEFAULT CHARSET=utf8"] at updatedatabase.pl
> line 1281.
>
> Has anybody has the correct definition of the table permissions?
>
> Regards.
>
> On Tue, Sep 13, 2016 at 11:35 AM, Rodrigo Santellan <rsantellan at gmail.com>
> wrote:
>
>> Hi,
>>
>> I have changed: 3.00.00.053 to remove the constraint to labels_templates
>> and now it goes smooth on that part. I'll add more logging when the db
>> query are executed because there are some tables like permissions that are
>> not created.
>>
>> Thanks a lot!
>>
>> On Tue, Sep 13, 2016 at 4:29 AM, Jonathan Druart <
>> jonathan.druart at bugs.koha-community.org> wrote:
>>
>>> It has been removed by
>>> commit c102b61ef58dc34860e8acf6cab6bd9a96dae0a1
>>> Date:   Mon Jan 4 14:18:01 2010 -0500
>>>     [26/30] Updating kohastructure.sql to reflect changes introduced
>>> in Patron Card Creator work
>>>
>>> But indeed these changes have not been put in the updatedatabase.pl
>>> file.
>>> You can ignore this table.
>>>
>>> 2016-09-13 0:02 GMT+01:00 Michael Hafen <michael.hafen at washk12.org>:
>>> > There's also update 61 which references the labels_templates table.
>>> You'd
>>> > have to omit that one too.
>>> > That table is gone, but I don't know when it gets dropped.  I looked
>>> through
>>> > updatedatabase.pl and didn't see it get dropped.  So I don't know.
>>> If you
>>> > are aiming for a recent release then it should be ok to omit the table
>>> and
>>> > those two updates.
>>> >
>>> > On Mon, Sep 12, 2016 at 1:04 PM, Rodrigo Santellan <
>>> rsantellan at gmail.com>
>>> > wrote:
>>> >>
>>> >> Passing the conditions in true (1 == 1 ) on lines 2623 and 3418 I'm
>>> able
>>> >> to pass further on the updatedatabase.pl
>>> >>
>>> >> But the problems are on migrating to 3.00.00.053 the definitions that
>>> are
>>> >> needed on that table are on 3.00.00.059. My intuition says to change
>>> the
>>> >> order, but I have to be honest that I don't know the consequences and
>>> >> according to the IRC chat the table labels_templates is gone.
>>> >>
>>> >> Should I ommit them both?
>>> >>
>>> >> Thanks!
>>> >>
>>> >> On Mon, Sep 12, 2016 at 1:56 PM, Michael Hafen <
>>> michael.hafen at washk12.org>
>>> >> wrote:
>>> >>>
>>> >>> Have you looked in the /installer/data/mysql directory at the
>>> >>> labels_upgrade.pl and patroncards_upgrade.pl scripts.  I think
>>> those where
>>> >>> supposed to be run by the updatedatabase.pl script, but I seem to
>>> recall
>>> >>> having trouble with that myself.
>>> >>>
>>> >>> On Mon, Sep 12, 2016 at 7:07 AM, Rodrigo Santellan <
>>> rsantellan at gmail.com>
>>> >>> wrote:
>>> >>>>
>>> >>>> Hi,
>>> >>>>
>>> >>>> I'm trying to do a migration or upgrade from koha 2.2.3 to koha 3. I
>>> >>>> know is a daunting task that I have embarked but I'm trying to
>>> bring back a
>>> >>>> library to the latest updates of the community.
>>> >>>>
>>> >>>> So far this are the steps I have done:
>>> >>>> 1 - I dump an empty schema of the DB and create a new one with the
>>> name
>>> >>>> koha3.
>>> >>>> 2 - Apply the update22to30.pl
>>> >>>> 3 - Import all the tables I could, the one that not been deleted.
>>> >>>> 4 - Run updatedatabase.pl
>>> >>>>
>>> >>>> And now I'm stuck there, I'm missing the table: labels_templates
>>> and the
>>> >>>> table printers_profile is different.
>>> >>>>
>>> >>>> I have asked on the IRC channel and they say that table
>>> labels_templates
>>> >>>> is gone on 3.18.
>>> >>>>
>>> >>>> I'm heading on a good direction? Or I should do a clean install and
>>> then
>>> >>>> try to import all the old data?
>>> >>>>
>>> >>>> I will appreciate any help! Thanks in advance!
>>> >>>>
>>> >>>> Regards.
>>> >>>>
>>> >>>> Rodrigo Santellán.
>>> >>>>
>>> >>>> _______________________________________________
>>> >>>> Koha-devel mailing list
>>> >>>> Koha-devel at lists.koha-community.org
>>> >>>> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
>>> >>>> website : http://www.koha-community.org/
>>> >>>> git : http://git.koha-community.org/
>>> >>>> bugs : http://bugs.koha-community.org/
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>> --
>>> >>> Michael Hafen
>>> >>> Washington County School District Technology Department
>>> >>> Systems Analyst
>>> >>>
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Michael Hafen
>>> > Washington County School District Technology Department
>>> > Systems Analyst
>>> >
>>> >
>>> > _______________________________________________
>>> > Koha-devel mailing list
>>> > Koha-devel at lists.koha-community.org
>>> > http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
>>> > website : http://www.koha-community.org/
>>> > git : http://git.koha-community.org/
>>> > bugs : http://bugs.koha-community.org/
>>> _______________________________________________
>>> Koha-devel mailing list
>>> Koha-devel at lists.koha-community.org
>>> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
>>> website : http://www.koha-community.org/
>>> git : http://git.koha-community.org/
>>> bugs : http://bugs.koha-community.org/
>>>
>>
>>
>


-- 
Michael Hafen
Washington County School District Technology Department
Systems Analyst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20160913/55ed54ae/attachment-0001.html>


More information about the Koha-devel mailing list