Changeset 806


Ignore:
Timestamp:
Mar 6, 2016, 10:09:44 AM (9 years ago)
Author:
chronos
Message:
  • Fixed: Set foreign constraint after Group column is set to valid values in StockMove.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UpdateTrace.php

    r803 r806  
    18581858  $Manager->Execute('ALTER TABLE `StockMove` ADD `Group` INT NOT NULL AFTER `File`, ADD INDEX (`Group`);');
    18591859  $Manager->Execute('ALTER TABLE `StockMove` ADD `Stock` INT NOT NULL AFTER `Time`, ADD INDEX (`Stock`);');
    1860   $Manager->Execute('ALTER TABLE `StockMove` ADD FOREIGN KEY (`Group`) REFERENCES `StockMoveGroup`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
    18611860  $Manager->Execute('UPDATE `StockMove` SET `Group`=(SELECT `Id` FROM `StockMoveGroup` WHERE `StockMoveGroup`.`DocumentLine` = `StockMove`.`DocumentLine`)');
    18621861  $Manager->Execute('UPDATE `StockMove` SET `Stock`= `StockFrom` WHERE `DocumentLine` = 7');
    18631862  $Manager->Execute('UPDATE `StockMove` SET `Stock`= `StockTo` WHERE `DocumentLine` = 8');
     1863  $Manager->Execute('ALTER TABLE `StockMove` ADD FOREIGN KEY (`Group`) REFERENCES `StockMoveGroup`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
    18641864  $Manager->Execute('ALTER TABLE `StockMove` DROP FOREIGN KEY StockMove_ibfk_2;');
    18651865  $Manager->Execute('ALTER TABLE `StockMove` DROP FOREIGN KEY StockMove_ibfk_1;');
     
    18671867  $Manager->Execute('ALTER TABLE `StockMove` DROP `StockFrom`, DROP `StockTo`, DROP `DocumentLine`;');
    18681868  $Manager->Execute('ALTER TABLE `StockMove` ADD FOREIGN KEY (`Stock`) REFERENCES `Stock`(`Id`) ON DELETE RESTRICT ON UPDATE RESTRICT;');
    1869  
     1869
    18701870  // Make BillCode as reference to DocumentLineCode table
    18711871  $Manager->Execute('ALTER TABLE `StockMove` CHANGE `BillCode` `BillCodeText` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL');
Note: See TracChangeset for help on using the changeset viewer.