Forum OpenACS Development: Re: primary key in cr_mime_types
"The problem is that the cr_mime_types table is not (and should not be) a mapping table of extension to mime type. Extension happens to be in the table but it is really a list of existing mime types.
There needs to be a table cr_extension_mime_type_map which handles this mapping and the mime type creation stuff should not be creating a mime type if one already exists."
(I hope he won't mind my posting his note - but he's asleep at the moment and can't do it himself :)
He said he was going to fix this but I don't know exactly when.
Also, ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types lists about a zillion mime types and I wonder if we should just create most of them by default (which would mean tracking down extensions for most of them).
Another issue is that as it stands I have defined the table as:
create table cr_extension_mime_type_map ( file_extension varchar(200) constraint cr_mime_type_extension_map_pk primary key, mime_type varchar(200) constraint cr_mime_ext_map_mime_type_ref references cr_mime_types );which would mean a unique entry per extension. I know it's not really valid but I think until we do the work on the UI side to allow for chosing the correct mime type it's probably better to enforce uniqueness.
The final one is that for some things I am not sure what the right generic extension to return would be when more than one is listed (the ext in cr_mime_types). An example being application/quicktime where both .qt and .mov are used.
Anyone want to figure it all out for me?