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

Jonathan Druart jonathan.druart at bugs.koha-community.org
Thu Sep 15 09:05:48 CEST 2016


Certainly 3.01.00.009
 2140     $dbh->do("ALTER TABLE permissions MODIFY `code` varchar(64)
DEFAULT NULL");
 2141     $dbh->do("ALTER TABLE user_permissions MODIFY `code`
varchar(64) DEFAULT NULL");

2016-09-14 21:14 GMT+01:00 Rodrigo Santellan <rsantellan at gmail.com>:
> I truncate the tables and try to use the: userpermissions.sql file.
>
> My problem is that code is defined like varchar(30) on update "3.00.00.068"
> but on http://schema.koha-community.org/tables/permissions.html is a
> varchar(64) I assume the later is the correct. When was this changed?
>
> Regards.
>
> On Wed, Sep 14, 2016 at 4:38 PM, Michael Hafen <michael.hafen at washk12.org>
> wrote:
>>
>> module_bit 13 is for tools.  From installer/data/mysql/userflags.sql :
>> INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES
>> (13,'tools','Use all tools (expand for granular tools permissions)',0);
>>
>>
>>
>> On Wed, Sep 14, 2016 at 1:10 PM, Rodrigo Santellan <rsantellan at gmail.com>
>> wrote:
>>>
>>> I have almost complete the updatadatabase.pl without db errors.
>>>
>>> Now I'm missing some data on userflags, what should be the 13 module_bit
>>>
>>> Upgrade to 3.00.00.067 done (Updating patronimages syspref to reflect
>>> current kohastructure.sql. )
>>> DBD::mysql::db do failed: Cannot add or update a child row: a foreign key
>>> constraint fails (`koha3`.`permissions`, CONSTRAINT `permissions_ibfk_1`
>>> FOREIGN KEY (`module_bit`) REFERENCES `userflags` (`bit`) ON DELETE CASCADE
>>> ON UPDATE CASCADE) [for Statement "INSERT INTO permissions (module_bit,
>>> code, description) VALUES
>>>     (13, 'edit_news', 'Write news for the OPAC and staff interfaces'),
>>>     (13, 'label_creator', 'Create printable labels and barcodes from
>>> catalog and patron data'),
>>>     (13, 'edit_calendar', 'Define days when the library is closed'),
>>>     (13, 'moderate_comments', 'Moderate patron comments'),
>>>     (13, 'edit_notices', 'Define notices'),
>>>     (13, 'edit_notice_status_triggers', 'Set notice/status triggers for
>>> overdue items'),
>>>     (13, 'view_system_logs', 'Browse the system logs'),
>>>     (13, 'inventory', 'Perform inventory (stocktaking) of your
>>> catalogue'),
>>>     (13, 'stage_marc_import', 'Stage MARC records into the reservoir'),
>>>     (13, 'manage_staged_marc', 'Managed staged MARC records, including
>>> completing and reversing imports'),
>>>     (13, 'export_catalog', 'Export bibliographic and holdings data'),
>>>     (13, 'import_patrons', 'Import patron data'),
>>>     (13, 'delete_anonymize_patrons', 'Delete old borrowers and anonymize
>>> circulation history (deletes borrower reading history)'),
>>>     (13, 'batch_upload_patron_images', 'Upload patron images in batch or
>>> one at a time'),
>>>     (13, 'schedule_tasks', 'Schedule tasks to run')"] at
>>> updatedatabase.pl line 1294.
>>>
>>>
>>> On Wed, Sep 14, 2016 at 11:12 AM, Rodrigo Santellan
>>> <rsantellan at gmail.com> wrote:
>>>>
>>>> Jonathan,
>>>>
>>>> I'm planning to open a bug report and patches when I finish. Don't want
>>>> open more than one bug.
>>>>
>>>> I'm adjusting some SQL that are not ok.
>>>>
>>>> Regards
>>>>
>>>> On Wed, Sep 14, 2016 at 4:16 AM, Jonathan Druart
>>>> <jonathan.druart at bugs.koha-community.org> wrote:
>>>>>
>>>>> These errors are fixes by 3.01.00.009, certainly because MySQL
>>>>> strictness has changed since 3.00.00.068
>>>>>
>>>>> Try to change the 2 code columns to default null.
>>>>> If it works, please open a new bug report (and attach a patch if you
>>>>> know how to do it :))
>>>>>
>>>>> Cheers,
>>>>> Jonathan
>>>>>
>>>>> 2016-09-13 16:34 GMT+01:00 Rodrigo Santellan <rsantellan at gmail.com>:
>>>>> > 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/
>>>>> >>
>>>>> >>
>>>>> >
>>>>> _______________________________________________
>>>>> 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
>>
>


More information about the Koha-devel mailing list