[Koha-bugs] [Bug 11897] Stock Rotation for Koha

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Oct 25 14:39:32 CEST 2018


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11897

--- Comment #369 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
Update DB is failing with strict_sql_modes ON:

DBD::mysql::db do failed: BLOB/TEXT column 'description' can't have a default
value [for Statement "                                                         
                                               [3/26]
          CREATE TABLE `stockrotationrotas` (
            `rota_id` int(11) auto_increment,         -- Stockrotation rota ID
            `title` varchar(100) NOT NULL,            -- Title for this rota
            `description` text NOT NULL default '',   -- Description for this
rota
            `cyclical` tinyint(1) NOT NULL default 0, -- Should items on this
rota keep cycling?
            `active` tinyint(1) NOT NULL default 0,   -- Is this rota currently
active?
            PRIMARY KEY (`rota_id`),
            CONSTRAINT `stockrotationrotas_title`
            UNIQUE (`title`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
        "] at installer/data/mysql/updatedatabase.pl line 16568.
DBD::mysql::db do failed: Can't create table
`koha_kohadev`.`stockrotationstages` (errno: 150 "Foreign key constraint is
incorrectly formed") [for Statement "
          CREATE TABLE `stockrotationstages` (
              `stage_id` int(11) auto_increment,     -- Unique stage ID
              `position` int(11) NOT NULL,           -- The position of this
stage within its rota
              `rota_id` int(11) NOT NULL,            -- The rota this stage
belongs to
              `branchcode_id` varchar(10) NOT NULL,  -- Branch this stage
relates to
              `duration` int(11) NOT NULL default 4, -- The number of days
items shoud occupy this stage
              PRIMARY KEY (`stage_id`),
              CONSTRAINT `stockrotationstages_rifk`
                FOREIGN KEY (`rota_id`)
                REFERENCES `stockrotationrotas` (`rota_id`)
                ON UPDATE CASCADE ON DELETE CASCADE,
              CONSTRAINT `stockrotationstages_bifk`
                FOREIGN KEY (`branchcode_id`)
                REFERENCES `branches` (`branchcode`)
                ON UPDATE CASCADE ON DELETE CASCADE
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
        "] at installer/data/mysql/updatedatabase.pl line 16583.
DBD::mysql::db do failed: Can't create table
`koha_kohadev`.`stockrotationitems` (errno: 150 "Foreign key constraint is
incorrectly formed") [for Statement "
          CREATE TABLE `stockrotationitems` (
              `itemnumber_id` int(11) NOT NULL,         -- Itemnumber to link
to a stage & rota
              `stage_id` int(11) NOT NULL,              -- stage ID to link the
item to
              `indemand` tinyint(1) NOT NULL default 0, -- Should this item be
skipped for rotation?
              `fresh` tinyint(1) NOT NULL default 0,    -- Flag showing item is
only just added to rota
              PRIMARY KEY (itemnumber_id),
              CONSTRAINT `stockrotationitems_iifk`
                FOREIGN KEY (`itemnumber_id`)
                REFERENCES `items` (`itemnumber`)
                ON UPDATE CASCADE ON DELETE CASCADE,
              CONSTRAINT `stockrotationitems_sifk`
                FOREIGN KEY (`stage_id`)
                REFERENCES `stockrotationstages` (`stage_id`)
                ON UPDATE CASCADE ON DELETE CASCADE
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
        "] at installer/data/mysql/updatedatabase.pl line 16604.


It looks scary but seems easy to fix,
  `description` text NOT NULL default ''
should not have a default value.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list