I have developed a SmartContract using ethereum which has an internal struct to store some of the privilege mapping. I find that whenever there is any change in the smart contract and the deployment is happening, the data is lost across upgrades.
SmartContract
contract PrivilegesContract is SuperAdminContract {
struct Privilege {
uint Id;
string Name;
}
uint private privilegeId;
mapping(uint => string) private Privileges;
function Add(string name) public EnsureSuperAdmin returns (uint) {
Privileges[privilegeId] = name;
privilegeId = privilegeId +1;
return privilegeId;
}
}
Is there any persistent store that we can use so that i can retrieve the data after a new deployment or be unaffected by the deployments. If there is no persistent datastore, we should have a mechanism to read and initialize the data from the previous transactions in the block. Kindly share the behavior to be followed.