Excluding Keys from Replication - Synergex/SqlReplication GitHub Wiki

By default all access keys that are defined on replicated files will be created as indexes in the associated SQL Server database table. But if you wish you can override this behavior via the use of a CodeGen Repository Override File.

Create a JSON file in your templates folder with content similar to this:

{
  "Structures": 
  [
    {
      "Name": "EMPLOYEE",
      "ExcludeKeys": [
        "ZIP_CODE"
      ]
    }
  ]
}

As you can see, the file defines an array of structures, and within each structure there is an array of key names to be excluded.

Once you have created this file and saved it in your templates folder, add a new option to your CodeGen command line used to generate your SQL Connection code:

-rpsoverride <filename>

Where filename is the name of the JSON file.

IMPORTANT: Remember that the replication environment uses the first unique key to synchronize data between your ISAM files and the SQL Server database tables. Don't exclude that key via this mechanism or replicator performance could deteriorate badly.

NOTE: Using this feature requires CodeGen 5.4.8 or higher.

⚠️ **GitHub.com Fallback** ⚠️