Ok, unless I'm missing something basic, the primary key for {term_fields} is wrong.

term_fields_schema() says the primary key is term_fields.fid, but that means that fid "xyzzy" can only appear in one vocab.

It seems to me that the correct primary key is (vid, fid).

Patch for an update function attached.

CommentFileSizeAuthor
term_fields_primary_key.patch653 bytesdotton

Comments

b-prod’s picture

Category: bug » feature
Status: Active » Needs work

Actually a fid can only appear for one vocabulary.
Modifying schema to have (vid, fid) as PK means changes in the module code.

Feel free to work on this feature, I would put it in the core if it take care of the current code in module.

Thanks for your interest.

dotton’s picture

Yeah, I see it now. You've got the field type bound up with the field name, so you can't have, say, a field 'blah' which is an int for $vid 1, and a longtext for $vid 2. It wasn't biting me 'cos my fields are all longtext.

First step would be to smooth out the db. I'm working round the problem right now by writing my own CRUD functions, but I'll think on the database issue, see if I can come up with a better schema.

b-prod’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Needs work » Fixed

Each field can now be used in all vocabularies.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.