Skip to content

Commit

Permalink
Fixed sql in function update_bom() id => component and optimised inde…
Browse files Browse the repository at this point in the history
  • Loading branch information
apmuthu committed Jan 7, 2015
1 parent 9197993 commit 36a3087
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions FAMods/CHANGELOG_apmuthu.txt
@@ -1,4 +1,5 @@

2015-01-07 Ap.Muthu Fixed sql in function update_bom() id => component and optimised indexes for 0_bom table
2015-01-04 Ap.Muthu Deprecated 0_cust_branch.contact_name field fixes backported from FA v2.4, also speeded up with GROUP BY.
2015-01-03 Ap.Muthu Standardised person_id field type tinyblob => int(11) in 0_bank_trans, 0_budget_trans, 0_gl_trans tables
2014-12-31 Ap.Muthu Bin Location and CID in PO reports from Non Field DB Data in Company 0
Expand Down
2 changes: 1 addition & 1 deletion FAMods/includes/db/manufacturing_db.inc
Expand Up @@ -211,7 +211,7 @@ function update_bom($selected_parent, $selected_component, $workcentre_added, $l
. ",loc_code=".db_escape($loc_code) . ",
quantity= " . $quantity . "
WHERE parent=".db_escape($selected_parent) . "
AND id=".db_escape($selected_component);
AND component=".db_escape($selected_component);
check_db_error("Could not update this bom component", $sql);

db_query($sql,"could not update bom");
Expand Down
6 changes: 6 additions & 0 deletions FAMods/sql/alter_to_latest2.3.sql
Expand Up @@ -25,3 +25,9 @@ ALTER TABLE `0_crm_contacts` ADD INDEX `person_id` (`person_id`);
ALTER TABLE `0_bank_trans` CHANGE `person_id` `person_id` INT(11) DEFAULT NULL;
ALTER TABLE `0_budget_trans` CHANGE `person_id` `person_id` INT(11) DEFAULT NULL;
ALTER TABLE `0_gl_trans` CHANGE `person_id` `person_id` INT(11) DEFAULT NULL;

ALTER TABLE `0_bom`
CHANGE `parent` `parent` VARCHAR(20) DEFAULT '' NOT NULL,
CHANGE `component` `component` VARCHAR(20) DEFAULT '' NOT NULL,
DROP INDEX `parent`,
DROP PRIMARY KEY, ADD PRIMARY KEY (`parent`, `loc_code`, `component`, `workcentre_added`);
7 changes: 3 additions & 4 deletions FAMods/sql/en_US-demo.sql
Expand Up @@ -170,16 +170,15 @@ INSERT INTO `0_bank_trans` VALUES (11, 26, 7, '1', '', '2009-06-21', -20, 0, 0,
DROP TABLE IF EXISTS `0_bom`;
CREATE TABLE IF NOT EXISTS `0_bom` (
`id` int(11) NOT NULL auto_increment,
`parent` char(20) NOT NULL default '',
`component` char(20) NOT NULL default '',
`parent` varchar(20) NOT NULL default '',
`component` varchar(20) NOT NULL default '',
`workcentre_added` int(11) NOT NULL default '0',
`loc_code` varchar(5) NOT NULL default '',
`quantity` double NOT NULL default '1',
PRIMARY KEY (`parent`,`component`,`workcentre_added`,`loc_code`),
PRIMARY KEY (`parent`,`loc_code`,`component`,`workcentre_added`),
KEY `component` (`component`),
KEY `id` (`id`),
KEY `loc_code` (`loc_code`),
KEY `parent` (`parent`,`loc_code`),
KEY `workcentre_added` (`workcentre_added`)
) ENGINE=MyISAM;

Expand Down
7 changes: 3 additions & 4 deletions FAMods/sql/en_US-new.sql
Expand Up @@ -159,16 +159,15 @@ CREATE TABLE IF NOT EXISTS `0_bank_trans` (
DROP TABLE IF EXISTS `0_bom`;
CREATE TABLE IF NOT EXISTS `0_bom` (
`id` int(11) NOT NULL auto_increment,
`parent` char(20) NOT NULL default '',
`component` char(20) NOT NULL default '',
`parent` varchar(20) NOT NULL default '',
`component` varchar(20) NOT NULL default '',
`workcentre_added` int(11) NOT NULL default '0',
`loc_code` varchar(5) NOT NULL default '',
`quantity` double NOT NULL default '1',
PRIMARY KEY (`parent`,`component`,`workcentre_added`,`loc_code`),
PRIMARY KEY (`parent`,`loc_code`,`component`,`workcentre_added`),
KEY `component` (`component`),
KEY `id` (`id`),
KEY `loc_code` (`loc_code`),
KEY `parent` (`parent`,`loc_code`),
KEY `workcentre_added` (`workcentre_added`)
) ENGINE=MyISAM;

Expand Down

0 comments on commit 36a3087

Please sign in to comment.