> For the complete documentation index, see [llms.txt](https://center-for-the-integration-of-id.gitbook.io/generate-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://center-for-the-integration-of-id.gitbook.io/generate-documentation/developer-guides/migration/data-migration.md).

# Data Migration

Generate makes use of data that have been migrated from that state source system, typically a State Longitudinal Database System (SLDS), into the Generate staging tables. Data can be migrated into Staging and through the Generate database either from the Generate Web Application “[Data Store](/generate-documentation/user-guide/settings/data-store.md)” pages or directly through SQL Server. Running from the Generate Web Application is recommended, especially when running Data Warehouse (RDS) and Reports Migration steps.&#x20;

### Location of Source to Staging ETL Code <a href="#location_of_etl_code" id="location_of_etl_code"></a>

ETL code should be placed in one or more stored procedures in the Generate database. By default, Generate has template scripts available by data domain (example: `Source.[Source-to-Staging_ChildCount`) which have a record in the `App.DataMigrationTasks` table. New Source to Staging ETL Code should reside in the Source schema, or a new schema (as long as the generate SQL user has access to that schema).

### Generate Web Application Migration Process <a href="#migration_process" id="migration_process"></a>

When a user triggers a Staging Migration via the Generate application, the following steps are executed by the Generate application in this order:

1. The `App.DataMigrationTasks` table is queried for all tasks with the following parameters:

> IsActive = 1
>
> DataMigrationTypeId = 1

2. The stored procedures found in the `App.DataMigrationTasks.StoredProcedureName` field from that query are then executed in ascending order of the `App.DataMigrationTasks.TaskSequence` field.

RDS and Reports Migrations use this same process but have different DataMigrationTypeId values.&#x20;


---

# 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://center-for-the-integration-of-id.gitbook.io/generate-documentation/developer-guides/migration/data-migration.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.
