Renamed Internal IDs Don't Increment

Status
Not open for further replies.

PtrNrs

Member
As I prefer to use globally unique mySQL field names, I have always changed the internal IDs (primary key fields) from the default "id". In Fabrik 2, this works fine.

In Fabrik 3.0a.2, however, when I insert records, the IDs set to 0. With field name "id", it works correctly.

I note that my tables don't have the ID field set to AUTO_INCREMENT.
I suspect this is due to the failure of the following command:-
Code:
ALTER TABLE `tblName` CHANGE `myID` `myID` INT(6)
 NOT NULL AUTO_INCREMENT
I'll research it a bit more and repost.
 
Now I'm having trouble reproducing this problem but, from memory, I was getting a message something like this:-
Code:
ALTER TABLE `tblName` CHANGE `` `` INT(6)
  NOT NULL AUTO_INCREMENT
ie with the field name missing.
 
The problem was that I'm using camel case field names . . .
In the function ammendTable() in /components/com_fabrik/models/list.php there's the following caution:-
PHP:
//@TODO: test (was strtolower($dbdescription->Field))
  if this is going to cause issues, think fields should be case insenitvely
 compared as some joomla core fields are mixed case
I think this needs to be accompanied by changing line 5448 from
PHP:
$objname = $obj->name;
to
PHP:
$objname = strtolower($obj->name);
I would provide a patch but I'm not GIT literate (GITerate?) yet.
 
I think you must have quite an old github version, as I believe ammendTable has moved to the backend model, and is now in ./components/com_fabrik/administrator/models/list.php, around line 1858.

It also no longer seems to have that comment you referenced, there's a more cryptic reference to doing the case lowering in the element model, by which I'm guessing Rob means when the element field is created.

So ... can you try updating to the latest github code. Just grab the latest ZIP or tarball from:

https://github.com/Fabrik/fabrik/downloads

... and schlepp it on top of your existing code. Where 'schlepp' is a deeply technical term, meaning to overwrite an existing code base with another, either by unpacking an archive in-situ over an existing code base, or unpacking it on your desktop and ftp'ing everything up. :)

Of course, if you have an actual git copy checked out into your server, just pull the latest updates.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top