Fix: ON DELETE CASCADE is forbidden.

Conflicts:
	htdocs/install/mysql/migration/3.6.0-3.7.0.sql
	test/phpunit/SqlTest.php
This commit is contained in:
Laurent Destailleur 2014-07-08 21:50:29 +02:00
parent f1d1736532
commit a137b31a47
4 changed files with 16 additions and 9 deletions

View File

@ -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;

View File

@ -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);

View File

@ -15,5 +15,6 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ============================================================================
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);

View File

@ -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;