> For the complete documentation index, see [llms.txt](https://docs.infotopics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.infotopics.com/trulyp/writebackextreme-old/features/management-console/schemas/migrate-from-data-add-to-data-correction-schema-1.md).

# Migrate from Data-Add to Data-Correction Schema

This guide explains how to migrate an existing Data-Add schema to a Data-Correction schema in WriteBackExtreme.

### 📘 Background: Relationship Types

#### Data-Add

* Uses a **many-to-many** relationship
* Stores mapping records in the `_mapping` table in the repository
* Ideal for appending new records per selection

#### Data-Correction

* Uses a **one-to-one** relationship
* Maps directly to a unique field or column
* Ideal for updating existing records tied to a Tableau datapoint

***

### 🎯 Goal of Migration

To move from inserting new records (many-to-many) to directly **updating existing records** (one-to-one), improving:

* ✅ **Data integrity**
* ✅ **Traceability**
* ✅ **Simplified correction logic**

***

### 🛠️ Migration Overview

1. **Create a new schema** using the `Data-Correction` module\
   \&#xNAN;*⚠️ Do **not** reuse the same schema name*
2. **Replicate all fields** from the existing Data-Add schema
3. **Add a new column** called: mapping\_key (String)

This column links each record to a unique identifier from Tableau

4. **Export the old data**

* Use the extension’s export feature
* Or request help from a database admin

5. **Prepare your data file**

* Add a new column in Excel/CSV called `mapping_key`
* Populate it with a **combined value** that uniquely identifies the record

**Example:**

* `product_id = "ABC123"`
* `country = "US"`
* Resulting `mapping_key = "ABC123_US"`

You can create this combined key as a calculated field in Tableau.

6. **Import the data** into your new Data-Correction schema
7. **Reconfigure the extension**

* Add the new schema to your dashboard
* Use the `mapping_key` Tableau field as the **identifier** in the schema configuration

***

### 🧪 Sample of how an Original Schema and a New Schema would look like

#### Original Schema (Data-Add)

**Name:** `dataadd_product_pricing_for_countries`

| Field | Type    |
| ----- | ------- |
| id    | UUID    |
| price | Decimal |

***

#### New Schema (Data-Correction)

**Name:** `datacorrect_product_pricing_for_countries`

| Field        | Type    |
| ------------ | ------- |
| id           | UUID    |
| mapping\_key | String  |
| price        | Decimal |

***

### 💡 Notes

* `mapping_key` must uniquely represent each Tableau selection
* Use a Tableau calculated field to concatenate values if needed
* Avoid auto-increment IDs if exact matching is required

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.infotopics.com/trulyp/writebackextreme-old/features/management-console/schemas/migrate-from-data-add-to-data-correction-schema-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
