Propose increase size of stockmaster StockID and Description #812
Replies: 11 comments 5 replies
-
|
Fyi, I just discovered a stock ID can't include a "space" character, That calls for the classic "space to underscore" global replacement! |
Beta Was this translation helpful? Give feedback.
-
I can't foresee any technical issue, besides that StockID appears in many tables and a zillion queries and reports. All of them should be checked. It is not a complex change, but a long and tedious one.
OK for me. As a reference, OpenCart uses model (our StockID) as varchar(64) and product name (our description) as varchar(255). R |
Beta Was this translation helpful? Give feedback.
-
Interesting. Iiuc LongDescription is 65K char (8-bit, less if multi-byte) and you are using it more for ad hoc notes than a "long description" per se (e.g. the "Long Description" that might be required on a shipping document). My initial expectation was that LongDescription might be at most 5x the Description, or max 100 char. However, it seems at least for you, LongDescription can be MUCH longer. Does anyone know off the top of their head if there are scripts that assume LongDescription is much shorter, or assume a specific purpose? If everyone is treating LongDescription as 65K of ad hoc text, perhaps the legend in the GUI should be "Notes" instead of "Long Description" to better imply the intended use. What do you think? |
Beta Was this translation helpful? Give feedback.
-
|
Back to stockid, using ChangeColumnSize() to change stockid results in a foreign key error at least on MariaDb. I see other functions in UpgradeDB_mariadb.php disable foreign key checking, should CangeColumnSize() do this also or is there a better way? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Can anyone say why the foreign key containts in the custitem table have embedded spaces in their names? Iiuc these are the ONLY foreign key constraints with spaces in their names and are, in the least, confusing special cases:
Would it be possible to remove the spaces? What would be involved? weberp/install/sql/tables/custitem.sql: |
Beta Was this translation helpful? Give feedback.
-
|
I think it is a typo error that should be corrected. R |
Beta Was this translation helpful? Give feedback.
-
|
Edit. Made original post a reply to @pakricard's instead to get back to the original topic - increasing stockid and description sizes. It seems I was naive thinking the only table with a foreign key to the stockmaster stockid column was the custitem table. After copy/pasting the name of the fk directly from mariadb cli output I was able to drop the constraint from the custitem table but then attempting to change the size of stockid resulted in an fk error in the bom table. After investigating, it seems there are many tables containing an explit fk relationship to stockmaster stockid. Btw, I don't know if the character at issue was actually a space or if it only appeared as a space and was actually e.g. a tab character. I don't think it would be difficult to use an upgrade xxx.php file to delete all the fk constraints in all the tables, adjust the sizes of parent and child tables and then re-create the fks, but before doing that, can anyone think of any issues? @pakricard @timschofield? Can it be presumed that all scripts that worked with a shorter stockid and description will continue to work as as expected when the stockid and description are shorter (i.e. comply with the current column size)? If there is no technical reason why stockid and description size can't be increased (albeit will be more work than originally expected), I think the choice comes down to either:
Larger values makes webERP more versatile which presumably adds value, while adding new "long" columns (which I a suspect is a well-known pattern and not something I just dreamed up) creates an additional layer of indirection, requires more scripts to be updated and increases the chaos factor. What do you think? WDYT? Drop fk's Try to change stockid size again What? How many tables do have a foreign key constraint to stockid? |
Beta Was this translation helpful? Give feedback.
-
|
P.S. There are 35 tables that have a "stockid" column, which I presume includes the 26 tables with an explicit foreign key constraint and means there are an additional 9 tables with an implicit foreign key relationship (treated as an fk by webERP code but without an explicit constraint). Does my analysis seem correct? |
Beta Was this translation helpful? Give feedback.
-
|
Sounds right to me. Some tables use stkcode to refer to stockid (I guess for historical reasons, some developers preferred one or another). Probably is time to unify all synonyms to stockid. Probably also unify all of them to varcahr, not char, to avoid type mismatches as PHP gets stricter on this issue at every new version. R |
Beta Was this translation helpful? Give feedback.
-
|
Fyi, found what appears to be the stockid foreign keys in two tables themselves being used as foreign keys in other tables. #835 |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm still working through importing stock items but an issue has arisen with the stock ID (part number), description (title) and long description (detail) being imported are larger than the webERP column sizes.
The maximum column widths in the data being imported are:
LongDescription is "text" which iiuc is 65K bytes, which is PNDetail in Parts&Vendors and has an max of 255 char so no issue. Fwiw, the absolute max for PNPartNumber (StockID) is 50 char and PNTitle (Description) is 255 char.
Q1. Are there any technical reasons why these column widths can't simply be increased to accomodate the data being imported? Would the only issues be table and report formating when scripts assume data will be shorter?
Q2. If there are no insurmountable technical reasons, would you be in favor of (or tolerant of) allowing the larger sizes in webERP?
Cheers,
Dale
Fwiw, posts that are somewhat related and in a general PLM theme include:
Z_ImportPartCodes.php fails Z_ImportPartCodes.php fails #741
Schema is missing an Item "Notes" field Schema is missing an Item "Notes" field #592
How to Import BOMs How to Import BOMs #591
What is purpose of Manufacturers and Brand Management? What is purpose of Manufacturers and Brand Management? #668
BOM item quantity needs more decimal places for accuracy BOM item quantity needs more decimal places for accuracy #702
Sales Orden Items with CSV with obsolete items error
(specifically Sales Orden Items with CSV with obsolete items error #808 (comment))
Beta Was this translation helpful? Give feedback.
All reactions