# Where is the “Danger Zone” for projects written in Motoko and deployed on the IC

**URL:** <https://forum.dfinity.org/t/where-is-the-danger-zone-for-projects-written-in-motoko-and-deployed-on-the-ic/11654>\
**Category:** Developers\
**Created:** [March 23, 2022, 6:32pm UTC](https://forum.dfinity.org/t/where-is-the-danger-zone-for-projects-written-in-motoko-and-deployed-on-the-ic/11654 "2022-03-23T18:32:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesse](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jesse/32/37836_2.png) [@Jesse](https://forum.dfinity.org/u/Jesse)\
**Post date:** [March 23, 2022, 6:32pm UTC](https://forum.dfinity.org/t/where-is-the-danger-zone-for-projects-written-in-motoko-and-deployed-on-the-ic/11654/1 "2022-03-23T18:32:06Z")

</div>

I recently deployed an app on the IC. I’m still in the testing phase, but I’m curious as to which files are critical for preserving canister data. `.dfx`, `dist`, and the `node_modules` Directory all seem like really important files. Is it the case that if these files are alter/deleted, that it’ll result in loss of data? Or can these files be simply recovered using npm install and dfx deploy and everything’s all good?

Essentially, i wanna know where i need to be extra careful in order to prevent data loss?

---

<div class="post-metadata">

**Author:** ![jzxchiang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jzxchiang/32/2592_2.png) [@jzxchiang](https://forum.dfinity.org/u/jzxchiang)\
**Post date:** [March 23, 2022, 9:07pm UTC](https://forum.dfinity.org/t/where-is-the-danger-zone-for-projects-written-in-motoko-and-deployed-on-the-ic/11654/2 "2022-03-23T21:07:39Z")

</div>

I think the actual replica state and canister memory cannot be recovered from the `.dfx` directory, if you deploy to mainnet.

I believe some folks on DFINITY like @akhilesh.singhania are working on a way for canister owners to download (and upload) the entire canister memory/state directly from mainnet.

---

<div class="post-metadata">

**Author:** ![skilesare](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/skilesare/32/5609_2.png) [@skilesare](https://forum.dfinity.org/u/skilesare)\
**Post date:** [March 24, 2022, 1:06am UTC](https://forum.dfinity.org/t/where-is-the-danger-zone-for-projects-written-in-motoko-and-deployed-on-the-ic/11654/3 "2022-03-24T01:06:42Z")

</div>

None of that is essential. Dfx Build will restore dist, and .dfx and nom install will restore node\_moduals.

The thing that will lose you data is changing data structures in your .no files. Some Kind of primer on what makes a braking change would be useful.

---

<div class="post-metadata">

**Author:** ![Jesse](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jesse/32/37836_2.png) [@Jesse](https://forum.dfinity.org/u/Jesse)\
**Post date:** [March 24, 2022, 12:46pm UTC](https://forum.dfinity.org/t/where-is-the-danger-zone-for-projects-written-in-motoko-and-deployed-on-the-ic/11654/4 "2022-03-24T12:46:27Z")

</div>

How would I go about making updates to data structures in my .mo files? is the only option for updating data structures to make an entirely new object type?

---

<div class="post-metadata">

**Author:** ![skilesare](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/skilesare/32/5609_2.png) [@skilesare](https://forum.dfinity.org/u/skilesare)\
**Post date:** [March 24, 2022, 2:01pm UTC](https://forum.dfinity.org/t/where-is-the-danger-zone-for-projects-written-in-motoko-and-deployed-on-the-ic/11654/5 "2022-03-24T14:01:14Z")

</div>

I’ve considered doing (bad code written on phone)

```
my_type ={#first; #second;};
my_type_v2 = {#first; #third};

func modifyfunc(anItem :my_type) : my_type_v2{
     Switch(anItem){
     //convert it

     }
};

post_upgrade(){
      for(thisitem in my_type_collection.vals()){
            my_type_v2_collection.add(modifyfunc(thisItem))
      }

};
```
