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