Example 1: AddAction
To create a patch file that adds a field to a table:
-
Close v1 of your app (MyApp-v1.fmp12) and run the upgrade tool with the
--generateGUIDs
subcommand and MyApp-v1.fmp12 as the source file. -
Save a copy of MyApp-v1.fmp12 as XML and name it MyApp-v1.xml.
-
Make a copy of MyApp-v1.fmp12 and name it MyApp-v2.fmp12.
-
Add a field to a table in MyApp-v2.fmp12.
-
Close MyApp-v2.fmp12 and run the upgrade tool with the
--generateGUIDs
subcommand and MyApp-v2.fmp12 as the source file. -
Save a copy of MyApp-v2.fmp12 as XML and name it MyApp-v2.xml.
-
Compare the relevant section of MyApp-v1.xml (left) and MyApp-v2.xml (right).
The notable change between MyApp-v1.xml and MyApp-v2.xml is the addition of a Field element under the FieldsForTables/FieldCatalog/ObjectList element.
Also note these important UUID elements or attributes:
-
Under the FieldCatalog element, the UUID element starts with A434D930 (line 47).
-
In the BaseTableReference element, the UUID attribute starts with 9B93EC91 (line 50).
-
Under the Field element, the UUID element starts with 9ADC7007 (line 111).
-
-
Create a plaintext patch file (v1-v2-patch.xml) that applies this change. Use the top-level structure shown in About the patch file. In the Structure element:
-
Add an AddAction element.
-
Under the AddAction element, re-create the structure down to the ObjectList element, using the UUID elements or attributes from the v2 FMSaveAsXML file.
-
Under ObjectList, add a Field element for the new field. You can include all the attribute and child elements from the v2 FMSaveAsXML file, but you must include the name and datatype attributes. Be sure to include the UUID element, so that in future upgrades, you can reference this field by this UUID, if needed.
Copy<?xml version="1.0"?>
<FMUpgradeToolPatch version="2.2.2.0">
<Structure>
<AddAction>
<FieldsForTables membercount="1">
<FieldCatalog>
<UUID>A434D930-F3BE-4833-A8CF-D8BE9A5A8D31</UUID>
<TagList></TagList>
<BaseTableReference id="129" name="Table" UUID="9B93EC91-B53E-407B-AF5B-F1961A8CD109">
</BaseTableReference>
<ObjectList membercount="6">
<Field DefaultStyle="" id="6" name="Note" fieldtype="Normal" datatype="Text" comment="">
<UUID>9ADC7007-D176-4872-8982-B33CD51FAA61</UUID>
<TagList></TagList>
</Field>
</ObjectList>
</FieldCatalog>
</FieldsForTables>
</AddAction>
</Structure>
</FMUpgradeToolPatch> -