---
title: Schema Definition
slug: schema-definition
createdAt: 2025-10-29T21:48:14.689Z
---

Each connector defines a schema that tells Activate how to build and manage its database tables. The schema is stored in the Connector\_Schema parameter.

# Example

:::BlockQuote
\<schema>
&#x20; \<dataTable>Department\</dataTable>
&#x20; \<importTable>Department\_Import\</importTable>
&#x20; \<historyTable enable="true">Department\_History\</historyTable>
&#x20; \<deleteCondition>$IMPORT$.Status = 'Deleted'\</deleteCondition>
&#x20; \<columns>
&#x20;   \<column name="departmentCode" type="varchar(12)" default="''" key="1" />
&#x20;   \<column name="department"     type="varchar(40)" default="''" />
&#x20;   \<column name="parentCode"     type="varchar(12)" default="''" />
&#x20; \</columns>
\</schema>
:::

# Element Reference

| Path                       | Required | Example                     | Description                                                            |
| -------------------------- | -------- | --------------------------- | ---------------------------------------------------------------------- |
| dataTable                  | ✅        | Department                  | Stores current data.                                                   |
| importTable                | ✅        | Department\_Import          | Temporary staging table for imports.                                   |
| historyTable               | ✅        | Department\_History         | Audit trail of changes. Use enable="false" to disable.                 |
| deleteCondition            | Optional | $IMPORT$.Status = 'Deleted' | Marks rows for deletion when using **flagged deletes**.                |
| columns/column/@name       | ✅        | departmentCode              | Column name in SQL.                                                    |
| columns/column/@type       | ✅        | varchar(12)                 | SQL data type.                                                         |
| columns/column/@default    | ✅        | '' or 0                     | Default value when none provided.                                      |
| columns/column/@columnName | Optional | departmentCode              | Physical column name override; defaults to @name.                      |
| columns/column/@key        | Optional | 1                           | Marks the key column. Only one per schema.                             |
| columns/column/@display    | Optional | 0/1                         | Hide from UI if 0.                                                     |
| columns/column/@multiValue | Optional | 1                           | Multi-value support (requires varchar(max), values delimited by \r\n). |
| columns/column/@foreignKey | Optional | Asset.AssetID               | Links to other Activate objects.                                       |
| columns/column/@noImport   | Optional | 1                           | Excluded from import; stored only in the data table.                   |

# Safe Schema Changes

- **Append** new columns at the end.&#x20;
- **Do not** change data types in the schema directly — first apply the SQL change, then align the schema.&#x20;
- **Avoid** reordering or removing columns; this breaks the definition.&#x20;

# Schema Regeneration

When the connector schema definition changes, you must regenerate the schema in **Activate Studio** to apply those changes.

To Regenerate the Schema

1. In **Activate Studio**, right-click the connector.&#x20;
2. Select **Connector Tasks → Regenerate Schema…**&#x20;
3. This will apply any new columns added at the end of the schema as per schema rules.&#x20;
   - Columns must always be appended at the end.&#x20;
   - Existing column types cannot be changed — these must be altered directly in SQL first.&#x20;

:::hint{type="danger"}
Dropping the schema deletes all connector data. After regeneration, **reimport and commit all changes** to prevent triggering unnecessary create, update, move, or delete actions.
:::

# Troubleshooting Schema Issues

If regeneration fails, review the schema XML for syntax or ordering errors.&#x20;

If the connector structure is corrupted, use **Connector Tasks → Drop Schema…** to remove existing tables, then regenerate.&#x20;

After regeneration, re-run the connector’s import workflow to rebuild data.&#x20;

