mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-24 04:44:35 +02:00
Add IGNORE to INSERT statements in migrations to prevent exceptions.
MySQL 5.7 or higher uses strict mode by default, and we would get an error during migration without that keyword.
This commit is contained in:
parent
da46257757
commit
4675793c24
3 changed files with 12 additions and 7 deletions
|
@ -46,14 +46,14 @@ final class Version20190902140506 extends AbstractMigration
|
|||
|
||||
/** Migrate the part locations for parts with known instock */
|
||||
$this->addSql(
|
||||
'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) ' .
|
||||
'INSERT IGNORE INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) ' .
|
||||
'SELECT parts.id, parts.id_storelocation, parts.instock, 0, NOW(), NOW() FROM parts ' .
|
||||
'WHERE parts.instock >= 0'
|
||||
);
|
||||
|
||||
//Migrate part locations for parts with unknown instock
|
||||
$this->addSql(
|
||||
'INSERT INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) ' .
|
||||
'INSERT IGNORE INTO part_lots (id_part, id_store_location, amount, instock_unknown, last_modified, datetime_added) ' .
|
||||
'SELECT parts.id, parts.id_storelocation, 0, 1, NOW(), NOW() FROM parts ' .
|
||||
'WHERE parts.instock = -2'
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue