Is this only happening to me?

I'e just installed CCK for 4.7 on a test site, and have been playing with it, and I've noticed that when I delete a content type, the fields that were attached to it remain in the fields listing under admin. It looks as though they're stuck there for good - there's no way to delete or change them, beyond perhaps going into the database and excising them manually.

Is there a reason for this?
Is there a problem with my install?
Am I just not understanding something?

Comments

edrex’s picture

Component: General » content.module
Assigned: Unassigned » edrex

Confirmed.

Deleting a content type leaves fields in place. The behavior should be the same as for removing a field from a content type: each field which isn't used by any other type should be removed.

I'll take a look at this.

Coyote’s picture

I _can_ see how it might be useful to leave fields in place until deleted by the user, in case one deletes a content type, but wants to re-use the fields. But there does need to be some way to clean up the fields in that case.

But failing that, yeah, I guess that recreating a field does only take a few moments. ; )

edrex’s picture

Assigned: edrex » Unassigned
Priority: Normal » Critical

I looked at this, and I can see what needs to change, but I don't know this code well enough to make a patch without potential unintended consequences.

The code in _content_admin_field_remove_submit that decides what to do with the row in {node_field} needs to be duplicated in _content_admin_type_delete_submit. I think that I would factor that code out into a new function.

Gerhard Killesreiter’s picture

This is still an issue. I deleted a content type and when creating a new ct I got the old fields offered, but chosing one of them gave me a db error:

content_alter_db_field INSERT INTO node_data_field_autor (vid, nid, field_autor_uid) SELECT vid, nid, field_autor_uid FROM node_

content_alter_db_field ALTER TABLE node_ DROP field_autor_uid

Note the broken table names.

JonBob’s picture

Status: Active » Fixed

Fixed in 4.7 version. This fix only affects newly deleted content types; still need to take care of orphaned fields. HEAD patch pending.

Anonymous’s picture

Status: Fixed » Closed (fixed)