# Step 1. Validate source db

This step checks whether your workspace still matches your **source database schema**.

Source schemas change over time. Tables can be added or removed. Column types can change. Constraints can be updated.

{% hint style="info" %}
Sync updates your **workspace** to match the source schema. It does **not** change data or schema in your source database.
{% endhint %}

{% hint style="warning" %}
Sync can remove or reset column generators when they become incompatible. Re-check your generator setup after syncing.
{% endhint %}

{% stepper %}
{% step %}

#### Open validation

Select **Generate** in the **Job configuration** panel.

Syntho opens the wizard on **Source Database Validation**.

Select **Validate** to compare your workspace schema against the source database.

This is the same action as that would be triggered when you select **Sync** in the top menu.

Validate detects schema drift. It does not apply changes.

<figure><img src="https://content.gitbook.com/content/U61B9DqtWCNO3Z30vnjh/blobs/wix1kinJtPstUXPLNXtM/image.png" alt="Source database validation warning showing schema drift and required sync action"><figcaption><p>Schema drift warning</p></figcaption></figure>
{% endstep %}

{% step %}

#### Sync schema changes

<figure><img src="https://1383248054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU61B9DqtWCNO3Z30vnjh%2Fuploads%2FVbqsaQZVpdQRdhLzfMpf%2Fimage.png?alt=media&#x26;token=ce7c2972-d999-4063-9de9-b4688aa173ef" alt="Source database validation screen showing Apply and Continue and Review changes actions"><figcaption><p>Sync options</p></figcaption></figure>

Pick one of these actions:

* **Apply and Continue** syncs your workspace immediately and keeps you in the wizard.
* **Review changes** opens **Table view** so you can inspect the schema changes and generator impact. Select **Apply** to sync or **Cancel** to discard.

{% hint style="warning" %}
Your workspace must be in sync to proceed with generation.
{% endhint %}

<figure><img src="https://1383248054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU61B9DqtWCNO3Z30vnjh%2Fuploads%2FMKcuK7GiYyOtcZbSqsr1%2Fimage.png?alt=media&#x26;token=692c7477-4273-4573-8c02-b1e926dee0a9" alt="Table view showing pending source schema changes and an apply or cancel decision"><figcaption><p>Review changes in Table view</p></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/U61B9DqtWCNO3Z30vnjh/blobs/ommyJefoY0Y9L62zNmM3/image.png" alt="Successful source database validation state after syncing"><figcaption><p>Successful validation after sync</p></figcaption></figure>
{% endstep %}

{% step %}

#### Re-check your job settings

After applying any synchronization changes, quickly review:

1. Columns where generators were removed or changed.
2. Key or constraint changes that affect referential integrity.
3. Any excluded tables that now participate in foreign keys.
   {% endstep %}
   {% endstepper %}

### Source schema synchronization

If source schema issues are left unresolved, your generation job can fail at runtime.

Syntho can automatically identify and sync the following schema changes.

<details>

<summary><strong>Source table changes</strong></summary>

1. The primary key of the table has changed.
2. The primary key of the table has been removed.
3. A primary key has been added to the table.
4. A foreign key has been removed from the table.
5. A foreign key has been added to the table.
6. The unique constraints for the table have been updated.
7. The check constraints for the table have been updated.
8. The table was removed.
9. The table was added.

</details>

<details>

<summary><strong>Source column changes</strong></summary>

1. The data type of the column has been updated.
2. The column is now auto-incrementing.
3. The column is not auto-incrementing anymore.
4. The maximum value of a column has changed.
5. The maximum length of a column has changed.
6. The default of the column has been updated.
7. The column is non-nullable now.
8. The column is now nullable.
9. The column is not unique anymore.
10. The column is now unique.
11. The column is not part of the primary key anymore.
12. The column is now part of the primary key.
13. The column is not part of a foreign key anymore.
14. The column is now part of a foreign key.
15. The column is not part of a composite unique constraint anymore.
16. The column is now part of a composite unique constraint.
17. The generator of the column has been removed.
18. The column was removed.
19. The column was added.

</details>

**Next:** continue to [Step 2. Validate destination db](https://docs.syntho.ai/configure-a-data-generation-job/generation-and-validation/validate-and-synchronize-workspace-1).
