From c1f88d99b9590a835a580df3f3a90ebcef7dbc80 Mon Sep 17 00:00:00 2001 From: KreizIT Date: Mon, 3 Mar 2014 14:11:19 +0100 Subject: [PATCH] Batch number management step 1 : database modification --- .../install/mysql/migration/3.5.0-3.6.0.sql | 26 +++++++++++++++++ .../tables/llx_expeditiondet_batch.key.sql | 19 +++++++++++++ .../mysql/tables/llx_expeditiondet_batch.sql | 27 ++++++++++++++++++ .../mysql/tables/llx_product_batch.key.sql | 19 +++++++++++++ .../mysql/tables/llx_product_batch.sql | 28 +++++++++++++++++++ 5 files changed, 119 insertions(+) mode change 100755 => 100644 htdocs/install/mysql/migration/3.5.0-3.6.0.sql create mode 100644 htdocs/install/mysql/tables/llx_expeditiondet_batch.key.sql create mode 100644 htdocs/install/mysql/tables/llx_expeditiondet_batch.sql create mode 100644 htdocs/install/mysql/tables/llx_product_batch.key.sql create mode 100644 htdocs/install/mysql/tables/llx_product_batch.sql 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 old mode 100755 new mode 100644 index 0a845dc76f8..9240cfe49b4 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -1010,3 +1010,29 @@ create table llx_product_customer_price_log fk_user integer, import_key varchar(14) -- Import key )ENGINE=innodb; + +--Batch number managment +ALTER TABLE llx_product ADD COLUMN tobatch tinyint DEFAULT 0 NOT NULL; + +CREATE TABLE IF NOT EXISTS `llx_product_batch` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product_stock` int(11) NOT NULL, + `eatby` datetime DEFAULT NULL, + `sellby` datetime DEFAULT NULL, + `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 IF NOT EXISTS `llx_expeditiondet_batch` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `fk_expeditiondet` int(11) NOT NULL, + `eatby` date DEFAULT NULL, + `sellby` date DEFAULT NULL, + `batch` varchar(30) DEFAULT NULL, + `qty` double NOT NULL DEFAULT '0', + `fk_origin_stock` int(11) NOT NULL, + KEY `ix_fk_expeditiondet` (`fk_expeditiondet`) +) ENGINE=InnoDB; \ 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 new file mode 100644 index 00000000000..2c5428d6224 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_expeditiondet_batch.key.sql @@ -0,0 +1,19 @@ +-- ============================================================================ +-- Copyright (C) 2014 Cédric GROSS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ +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; diff --git a/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql new file mode 100644 index 00000000000..abe5590328f --- /dev/null +++ b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql @@ -0,0 +1,27 @@ +-- ============================================================================ +-- Copyright (C) 2014 Cédric GROSS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ +CREATE TABLE llx_expeditiondet_batch ( + `rowid` int NOT NULL AUTO_INCREMENT PRIMARY KEY, + `fk_expeditiondet` int NOT NULL, + `eatby` date DEFAULT NULL, + `sellby` date DEFAULT NULL, + `batch` varchar(30) DEFAULT NULL, + `qty` double NOT NULL DEFAULT '0', + `fk_origin_stock` int NOT NULL +) ENGINE=InnoDB; + diff --git a/htdocs/install/mysql/tables/llx_product_batch.key.sql b/htdocs/install/mysql/tables/llx_product_batch.key.sql new file mode 100644 index 00000000000..6c184f2e1b3 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_batch.key.sql @@ -0,0 +1,19 @@ +-- ============================================================================ +-- Copyright (C) 2014 Cédric GROSS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- 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; diff --git a/htdocs/install/mysql/tables/llx_product_batch.sql b/htdocs/install/mysql/tables/llx_product_batch.sql new file mode 100644 index 00000000000..2d6df675cf8 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_batch.sql @@ -0,0 +1,28 @@ +-- ============================================================================ +-- Copyright (C) 2014 Cédric GROSS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ +CREATE TABLE `llx_product_batch` ( + `rowid` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `fk_product_stock` int(11) NOT NULL, + `eatby` datetime DEFAULT NULL, + `sellby` datetime DEFAULT NULL, + `batch` varchar(30) DEFAULT NULL, + `qty` double NOT NULL DEFAULT 0, + `import_key` varchar(14) DEFAULT NULL +) ENGINE=InnoDB; +