Core synchronization procedures

The core synchronization procedures are essential for maintaining the integrity and consistency of metadata within the MFSQL Connector. This section provides an overview of the key synchronization procedures, their purposes, and best practices for ensuring effective metadata management.

The first step after initial installation is to run the procedure spMFSynchronizeMetadata to populate the metadata structure tables. This procedure connects to the M-Files vault and retrieves the current metadata structure, including object types, classes, properties, and relationships. It then populates the corresponding SQL tables with this information. The procedure spMFDropAndUpdateMetadata is used to drop and update the metadata structure tables based on changes in the M-Files vault. This procedure is particularly useful when there are significant changes to the metadata structure, such as adding or removing classes or properties. It ensures that the SQL tables accurately reflect the current state of the M-Files vault.

Warning

This procedure will drop and recreate the metadata structure tables, which may result in data loss if not handled carefully. Do not run this procedure while updates are being made to the class tables.

Warning

This procedure must be run before any updates are processed from SQL to M-Files after changes to the metadata structure in M-Files. Failure to do so may result in inconsistencies and errors during data synchronization.

Running this procedure with the default parameters check the last metadata structure version id in the vault and compares it with the last version id stored in the table MFSettings. If the version natches with the version in the table, no changes are made to the metadata structure tables. If there is a difference, the procedure will update all the metadata structure tables to reflect the current state of the M-Files vault.

Using the parameter @IsStructureOnly = 0 will force the procedure to update the metadata structure tables regardless of the version id.

Practical examples of using the procedure with different parameters are provided in the example script section.

01.100 Getting Started and 01.103 InitialiseApp provide practical examples of using these core synchronization procedures during startup.

01.105 Metadata Structure Changes provides a practical example of using these core synchronization procedures in during startup.

01.105.MetadataStructureChanges provides a practical example of using these core synchronization procedures when there are changes to the metadata structure in M-Files.

For more granular updates, the procedure spMFSynchronizeSpecificMetadata allows for synchronizing specific parts of the metadata structure based on provided parameters. This procedure can be used to update specific classes, properties, or object types without affecting the entire metadata structure. This is discussed in more detail in the section on 04.selective-and-advanced-sync.