diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index b3d71fe5af7..8c8bebe8b73 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -156,7 +156,6 @@ CREATE TABLE llx_product_batch ( batch varchar(30) DEFAULT NULL, qty double NOT NULL DEFAULT 0, import_key varchar(14) DEFAULT NULL, - KEY ix_fk_product_stock (fk_product_stock) ) ENGINE=InnoDB; CREATE TABLE llx_expeditiondet_batch ( @@ -167,7 +166,6 @@ CREATE TABLE llx_expeditiondet_batch ( batch varchar(30) DEFAULT NULL, qty double NOT NULL DEFAULT 0, fk_origin_stock integer NOT NULL, - KEY ix_fk_expeditiondet (fk_expeditiondet) ) ENGINE=InnoDB; -- Salary payment in tax module @@ -191,6 +189,10 @@ CREATE TABLE llx_payment_salary ( fk_user_modif integer )ENGINE=innodb; +ALTER TABLE llx_product_batch ADD INDEX idx_fk_product_stock (fk_product_stock); +ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid); + + -- New 1074 : Stock mouvement link to origin ALTER TABLE llx_stock_mouvement ADD fk_origin integer; ALTER TABLE llx_stock_mouvement ADD origintype VARCHAR(32); @@ -1672,4 +1674,4 @@ INSERT INTO llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, -- Fix: Missing instruction not correctly done into 3.5 -- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_mode_reglement DROP NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_cond_reglement DROP NOT NULL; - \ No newline at end of file + diff --git a/htdocs/install/mysql/tables/llx_expeditiondet_batch.key.sql b/htdocs/install/mysql/tables/llx_expeditiondet_batch.key.sql index 2c5428d6224..f0438b6316c 100644 --- a/htdocs/install/mysql/tables/llx_expeditiondet_batch.key.sql +++ b/htdocs/install/mysql/tables/llx_expeditiondet_batch.key.sql @@ -16,4 +16,4 @@ -- -- ============================================================================ ALTER TABLE llx_expeditiondet_batch ADD INDEX ix_fk_expeditiondet (fk_expeditiondet); -ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet (rowid) ON DELETE CASCADE; +ALTER TABLE llx_expeditiondet_batch ADD CONSTRAINT fk_expeditiondet_batch_fk_expeditiondet FOREIGN KEY (fk_expeditiondet) REFERENCES llx_expeditiondet(rowid); diff --git a/htdocs/install/mysql/tables/llx_product_batch.key.sql b/htdocs/install/mysql/tables/llx_product_batch.key.sql index 6c184f2e1b3..f1f24c8b81a 100644 --- a/htdocs/install/mysql/tables/llx_product_batch.key.sql +++ b/htdocs/install/mysql/tables/llx_product_batch.key.sql @@ -15,5 +15,6 @@ -- along with this program. If not, see . -- -- ============================================================================ -ALTER TABLE llx_product_batch ADD INDEX ix_fk_product_stock (fk_product_stock); -ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid) ON DELETE CASCADE; + +ALTER TABLE llx_product_batch ADD INDEX idx_fk_product_stock (fk_product_stock); +ALTER TABLE llx_product_batch ADD CONSTRAINT fk_product_batch_fk_product_stock FOREIGN KEY (fk_product_stock) REFERENCES llx_product_stock (rowid); diff --git a/test/phpunit/SqlTest.php b/test/phpunit/SqlTest.php index bd2a3c57b5d..f86c6fcc57b 100755 --- a/test/phpunit/SqlTest.php +++ b/test/phpunit/SqlTest.php @@ -149,11 +149,15 @@ class SqlTest extends PHPUnit_Framework_TestCase $result=strpos($filecontent,'`'); print __METHOD__." Result for checking we don't have back quote = ".$result."\n"; - $this->assertTrue($result===false); + $this->assertTrue($result===false, 'Found ON back quote. Bad.'); $result=strpos($filecontent,'int('); - print __METHOD__." Result for checking we don't have back 'int(' instead of integer = ".$result."\n"; - $this->assertTrue($result===false); + print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n"; + $this->assertTrue($result===false, 'Found int(x) instead of integer. Bad.'); + + $result=strpos($filecontent,'ON DELETE CASCADE'); + print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n"; + $this->assertTrue($result===false, 'Found ON DELETE CASCADE. Bad.'); } return;