Hi Guys,
For storage of multiple values, I need to alter the 't_item_meta' table to allow multiple instances of the same fk_i_field_id for any given fk_i_item_id.
This is to be used for a modified version of the 'DROPDOWN' custom field type, to a kind of multi-select (More specifically, a bootstrap button group).
My method up until now has been to store the resulting values into a comma seperated list, however this creates problems when attempting to search the fields, forcing me to return all results that have the particular fk_i_item_id stored, then filtering them with PHP. I'd prefer the searching to all be handled within SQL.
Unfortunately, the primary key of the table is as follows:
PRIMARY KEY (`fk_i_item_id`,`fk_i_field_id`,`s_multi`),
This obviously needs to be removed, as it will not allow recurring values for fk_i_field_id on a given item.
The table has the following constraints:
CONSTRAINT `oc_t_item_meta_ibfk_1` FOREIGN KEY (`fk_i_item_id`) REFERENCES `oc_t_item` (`pk_i_id`),
CONSTRAINT `oc_t_item_meta_ibfk_2` FOREIGN KEY (`fk_i_field_id`) REFERENCES `oc_t_meta_fields` (`pk_i_id`)
Attempting to drop the primary key results in:
ERROR 1025 (HY000): Error on rename of './mrzt63d9_osclass/#sql-415f_54b483b' to './mrzt63d9_osclass/oc_t_item_meta' (errno: 150)
Any ideas as to how I would go about removing this primary key, and what other ramifications I might see as a result?
My understanding is that I'll need to remove the constraints and re-add them, however my SQL knowledge is not to the level of understanding contraints yet. How would I go about removing and re-adding these constraints?
Cheers,
Haioken.