# Updating struct cause damage to data

**URL:** <https://forum.openzeppelin.com/t/updating-struct-cause-damage-to-data/2653>\
**Category:** SDK\
**Created:** [April 14, 2020, 12:50pm UTC](https://forum.openzeppelin.com/t/updating-struct-cause-damage-to-data/2653 "2020-04-14T12:50:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [April 15, 2020, 2:23am UTC](https://forum.openzeppelin.com/t/updating-struct-cause-damage-to-data/2653/2 "2020-04-15T02:23:27Z")

</div>

Hi @shakeib98,

I assume that you are referring to this advice on structs and upgradeable contracts:

> [@Are there restrictions on modifying enums and structs in upgradeable contracts?](https://forum.openzeppelin.com/t/are-there-restrictions-on-modifying-enums-and-structs-in-upgradeable-contracts/2088/2):
>
> There are restrictions on modifying enums and structs, though it depends what you are modifying and where you use your enums and structs. For an overview on the restrictions of not changing order or type of state variables see [Modifying Your Contracts](https://docs.openzeppelin.com/upgrades/2.6/writing-upgradeable#modifying-your-contracts) documentation. Structs [https://solidity.readthedocs.io/en/latest/types.html#structs](https://solidity.readthedocs.io/en/latest/types.html#structs) If you have a contract state variable of the struct type, then you most likely won’t be able to add any fields (unless the variable is the last one on your contr…

If I understand correctly, you have a mapping to an array of structs, and not a mapping to a struct. I assume that adding fields to a struct used in an array will likely cause issues.

I recommend thorough testing of upgrades before making them in production.  
See the following article for testing real world contract upgrades:

> **[Testing real-world contract upgrades - OpenZeppelin blog](https://blog.openzeppelin.com/testing-real-world-contract-upgrades)**
>
> Deploying to production can be a stressful experience, especially if you don’t have a proper suite of tests to ensure that what you built will run smoothly.

I am not sure if there is a way to recover, it may depend what changes have been made to the state since upgrading.

---

_[View the full topic](https://forum.openzeppelin.com/t/updating-struct-cause-damage-to-data/2653)._
