Production Environment Setup

Hello,
Just a few questions for setting up the production environment.
We have some test data on the Production environment and we will like to clean out that test data so we can use real data is on the Production environment.
From the Global Data Model, how do we know which data is specifically for the Production environment and not the Dev and Test.
When adding data to the Production environment, how do we ensure that this is only visible/used in the production environment?

Thank you

Hi Jemea,

For clearing any testdata in a production environment, we would recommend creating a config/admin app with functionality for deleting the desired objects. An alternative could be deleting the objects using GraphQL.

Appfarm Create contains three databases

  • Development Database
  • Test Database
  • Production Database

When working in the development environment, all the user data is stored in the development database. The same goes for the test environment, which stores data in its own separate test database. For staging and production, they share the same database meaning that any objects you create, update or delete in staging are the same objects that exist in production and vice versa.

All object classes in the global data model exists in each database as separate tables containg whatever data that has been created in the particular environment.

That means that you don’t need to do anything to ensure that data created in production is only visible in the production (and staging) environment or that any test data is available in the production environment. Appfarm Create handles this for you.

Hope this answer your question.

2 Likes

Thank you for the feedback Erik.
A follow up question: How can one handle ‘bound by delete constraint’ errors when trying to delete in production using Graphql?
We will like to delete all the data in production (except users) some of these object classes are references to others. We have set most of the delete constraints to None which should enable us delete entries fine but we can’t and we still get this error. Any idea what we can do to fix this?

Hi,

The bound by delete constraint error will occur when trying to delete an object that is referenced by another object. I believe the error message should point you in the direction of which object class that references the objects that your are trying to delete and hence is blocking the deletion process.

Therefore you should make sure that the objects in that object class are deleted first, before deleting objects in the original object class. You may have to do some trial-and-error to find the correct order to delete objects in the different object classes, but the general idea is to start from the leaf nodes when looking on your data model as tree view and then working your way up to the top.

You may have to enforce some delete constraints to be None. This may be relevant for data models where you have circular references between objects. If you still get this error, it means that there are still referenced objects that has to be deleted first, and we would recommend the approach above to try and identify the correct order of deleting objects.

Changing all delete rules to None is generally not adviced as it may lead to orphan objects in your solution if you are not careful on how you perform deletions.

If you feel comfortable in the chain of objects that should be deleted, you could enforce the cascade delete option on the referenced object properties. This will make sure that the referenced objects are deleted when deleting the object that they are referencing. This can be dangerous when used without caution, as a simple delete may delete other objects that the user did not expect if the setup is not correct.

If you still fail to delete the objects in different object classes, you could try to update all object references to null using GraphQL. This may however take some time if you have a lot of object classes and references.

Best regards,

Eirik

1 Like