Compare schemas
Checking that the agents are compatible
Making an agent which works is not enough: you also need to make sure that it generates a schema where the naming of most entities is the same as the old one.
This is because all the UI / and security customizations that you have made are identified by the name of the entity to which they are applied.
This is valid for:
Charts (in dashboards and the collection view)
Order and visibility of fields in table-view, detail-form, related data, segments
Roles and Scopes
Segments visibility
Summary views and Workspaces
Example
For instance, if you created a chart on the customers
collection that displays the TOP 10 customers by number of orders, you will need to make sure that:
The
customers
collection still exists and has the same nameThe
orders
collection still exists and has the same nameThe
customers
collection still has a relationship calledorders
Checking the compatibility with .forestadmin-schema.json
, jq
and diff
.forestadmin-schema.json
, jq
and diff
jq
is a command line tool that allows you to manipulate JSON files. If you don't have it installed, you can install it with one of the following methods ↗ or use it online ↗.diff
is a command line tool that allows you to compare two files. It is installed by default on virtually all Unix systems, windows users can use online versions ↗.
To ensure agents are compatible, we have a tool at our disposal: the .forestadmin-schema.json
file.
However, diffing two .forestadmin-schema.json
files is extremely tedious: the file contains a lot of information that is not relevant to our objective.
Instead, we can choose to focus on the differences that matter the most: the name of the different entities.
Extracting the list of entities
Extracting the list of entities exported by an agent can be done with the following jq
command.
Run this command in the directory of both your old and new agent: it will generate a file called agent-entities.txt
in the current directory.
Comparing the list of entities
Once you have generated the agent-entities.txt
file for both your old and new agent, you can diff them with the following command:
Diff files are read using the following format:
>
: line is present in the new file, but not in the old one<
: line is present in the old file, but not in the new one'|': line is present in both files, but the content is different
Fixing differences
Once you have identified the differences, you can fix them by:
Danger level | Difference | Fix |
---|---|---|
🔴 | Collections or fields have different names (i.e. | Rename the collections in the new agent (docs) |
🔴 | Missing Smart features (actions, fields, relationships, segments, ...) | Port the missing smart features to your new agent (docs) |
🟢 | Extra collections | You can remove them (docs) |
🟢 | Extra fields | You can remove them (docs) |
Last updated