Data Structure
The root entity is a Site.
A User can create one or more Sites (limitations my apply if your instance supports payment plans).
A Site has Models. A Model has Fields.
Site, Model and Field have a Name property. It must be unique:
for Site — belonging to one User
for Model — belonging to one Site
for Field — belonging to one Model
When user creates a Site, Model or Field and sets its name, the nameId property is generated — it comes out of name by replacing special symbols. It it unique — it is ensured by adding _increment postfix if it needs. If user renames site (model, field), its nameId property stays the same.
Site's nameId is created using this pattern (an owner's email used):
ct____${filteredEmail}____${filteredName}
A function for email filtering :
encodeURIComponent(email)
.replace(/[!'()*.~_-]/g, c =>
'%' + c.charCodeAt(0).toString(16)
)
.replace(/%/g, `_`);
Content Items are stored in tables, there is one created for each Model. A table's name forms when user creates a model by this pattern:
ct____${site.nameId}____${model.nameId}
Table fields have same names as Model fields' nameIds.
If you want to delete a field, you should add disabled option to it first via the Model editing UI or via Parse-Dashboard.
You can't delete a Model while there are content items of its type. You should delete them first.
You can delete a whole Site, with its Models, Fields and Content Items.