We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Unable to Recreate Deleted Field

How Do I?

cjorgensen's avatar
cjorgensen
393 posts
6 years ago
cjorgensen's avatar cjorgensen

I am redesigning a website. I had an existing custom field call website. I meant to remove it from a field group, but I accidentally deleted it in its entirely. No huge loss. An annoyance at best (or so I thought).

I tried to recreate it, but I get an error that says the field short name needs to be unique.

When I search all fields it is not there. When I search by type it’s not there.

When I try to recreate it, I get a “Shortname must be unique” error.

So to test I created website2, deleted it, and recreated it. No problem. So I tried to recreate the original again, same error.

Now, my theory is that this is because my database has data in entries for this field.

I’d rather NOT have to do the data entry for some 200 posts, but will.

I’d prefer not to have to modify all the templates using this shoirtname, but I will.

I’d prefer to just somehow recreate the field and reassociate it with existing data, but if this isn’t possible, I’d like to get the field created with the same name. If that’s not possible, I’d like to make sure I don’t have a lot junk data in the DB.

I am not a DB guy, so any help would be great.

Thanks!

       
Rob Allen's avatar
Rob Allen
3,105 posts
6 years ago
Rob Allen's avatar Rob Allen

Normally when you delete a field it would delete all the content from that field in the database. Deleting a field is final so I don’t think you’ll have any other choice than to re-enter the data at some point.

The only place I know of where the field shortname is stored is in the exp_channel_fields DB table, might be worth looking through there to see if it didn’t get deleted. Access it via the CP (Developer > Utilities > SQL manager)

Also try clearing out the EE cache and your browser cache in case you have old data in there.

? 1
       
cjorgensen's avatar
cjorgensen
393 posts
6 years ago
cjorgensen's avatar cjorgensen

Thanks for your help and replay!

So you are correct. There is still a residual short name. I did come to the conclusion that the data was gone, but eh, I’ll manage.

29 2 website Website Website of address.

So now do I just nuke that short name?

I backed up the existing DB. 😊

I had cleared the cache in EE and in the browser. I almost thought that was going to work, since the error took a second longer to show up, but it was still there.

After I made this post I decided to put the site in logging and debugging mode, but the errors were things like, “Unable to edit field ID 28.” So I started digging though the various field types and finding nothing.

I figured the data was gone, but it’s no big deal at all. I do have a back up of the database that will for sure have all the data and most of it is easily rediscoverable. I’d fall back, but I’ve done like two weeks of redesign work.

The lessons here is obviously to do more DB backups on a more regular basis.

       
cjorgensen's avatar
cjorgensen
393 posts
6 years ago
cjorgensen's avatar cjorgensen

So I used phpmyadmin and nuked the field. It allowed me to recreate it. I’m mostly happy now. Thanks for your help. I will have to reenter the data, but am glad I discovered this at this point in the process. It would have sucked to get to the end and THEN figured this out.

       
Robin Sowell's avatar
Robin Sowell
13,255 posts
6 years ago
Robin Sowell's avatar Robin Sowell

> I’d fall back, but I’ve done like two weeks of redesign work.

If the design work was all done in the templates. you could fall back and then just replace your template tables. It sounds like it’s not a real problem to reenter the data, which is the safest bet. But if it is, just using the new exp_templates and exp_template_groups would likely restore the design work.

If you’re saving global variables and partials, you’d need to pull those tables over too.

But very glad Rob got you squared away!

? 1
       
Rob Allen's avatar
Rob Allen
3,105 posts
6 years ago
Rob Allen's avatar Rob Allen

Yeh pleased you got it sorted. We’ve all done similar things, from past experience I always double check when deleting something!

       
cjorgensen's avatar
cjorgensen
393 posts
6 years ago
cjorgensen's avatar cjorgensen

I was tired and I thought I was just removing it from the field group, not nuking the field. It’s working again and I am getting the site addresses all put back in.

This one can be marked as “solved.” Thanks!

? 1
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.