Migration from MDS
Primentra includes built-in migration wizards to import models, entities, and master data from SQL Server Master Data Services (MDS). The migration is a two-step process — always run them in this order:
- Models & Entities Wizard — Import the model structure (models, entities, attributes)
- Master Data Wizard — Import the actual data records
Requirements:
- SQL Server 2016 or later (both wizards use
FOR JSON PATH) - Access to the MDS database (
mdmschema) - sqlcmd utility for data export (SSMS truncates large datasets)
What Gets Migrated
| Source | What is imported |
|---|---|
| Models (mdm.tblModel) | Name, Description, CreatedOn, UpdatedOn |
| Entities (mdm.tblEntity) | Name, Description, CreatedOn, UpdatedOn |
| Attributes (mdm.tblAttribute) | DisplayName, Name, DataType, MaxLength, SortOrder, IsRequired, IsCode, IsName, Description, Domain reference |
| Master Data (entity tables) | Code, Name, all non-system attribute values, domain values |
Data type mapping: Text → Text, Number → Int, Decimal → Decimal (decimal places preserved), DateTime → DateTime, Domain → Domain, Link → Text
Not migrated (by design): Change tracking, filter options, created/modified by user, business rules, derived hierarchies.
All original timestamps (CreatedOn, UpdatedOn) are preserved — the import date is not used.
Step 1: Models & Entities Wizard
Access via the gear menu → Migration Wizards → Models & Entities.
- Copy the SQL script from the Instructions step and save it as a
.sqlfile (e.g.C:\Temp\export_mds_model.sql) - Open PowerShell and locate
sqlcmd.exeon your system using the provided command - Run the sqlcmd export command (replace server, database and sqlcmd path)
- Upload the generated
import_model.jsonfile in the next step
The wizard parses the JSON, shows a preview of all discovered models and entities, maps MDS data types, resolves domain attribute references, and offers per-entity conflict resolution (Skip or Overwrite). Descriptions are imported at all levels (Model, Entity, Attribute).
Step 2: Master Data Wizard
Access via the gear menu → Migration Wizards → Master Data.
- Copy the dynamically generated SQL query
- Save it as a
.sqlfile - Run via sqlcmd (not SSMS, which truncates large datasets):
- Upload the output
.ndjsonfile
The output format is NDJSON (Newline Delimited JSON) — one JSON object per line. Each line is a self-contained JSON object for one entity (or one batch of 200 rows). The wizard reassembles batches automatically.
Import actions per entity:
| Action | Behavior |
|---|---|
| Import | Add new rows, skip if Code already exists |
| Overwrite | Match on Code, update existing + add new |
| Delete + import | Clear all existing data, import fresh |
Bulk actions are available: Import all, Overwrite all, Delete+import all. Import ordering is dependency-aware — parent entities are processed before children. Domain values are resolved from display text to internal IDs server-side.
Import progress:
During import, a progress overlay is displayed showing:
- A circular animated ring with the overall percentage complete
- An overall progress bar (e.g. "3 of 15 entities")
- A per-entity progress bar estimated from row count

Cancel and rollback:
A Cancel button is available throughout the import. Pressing it stops the import after the current entity finishes — mid-entity imports are not aborted mid-stream.
When cancelled, all entities that were already imported in that session are rolled back — not just the entity being processed at the time of cancellation, but every entity imported before it as well. Rollback works by purging all rows from those entities (clearing them completely).
Example: if you cancel on entity 3 of 5, entities 1, 2, and 3 are all purged. Entities 4 and 5 are never imported.
After rollback completes, the preview screen shows a confirmation banner: "Import cancelled. Rolled back N entities." The rollback status is also shown in red in the progress overlay while it is running.
sqlcmd flags explained:
| Flag | Purpose |
|---|---|
-S server | SQL Server hostname |
-d database | MDS database name |
-E | Windows Authentication (use -U user -P pass for SQL auth) |
-i export.sql | Input file (the saved SQL script) |
-h -1 | Suppress column headers |
-y 0 -Y 0 | Unlimited column width (prevents truncation) |
-o output.ndjson | Output file |
The Master Data wizard generates a dynamic SQL script that exports all data from your MDS entities. The script uses a cursor to iterate over all entities, builds dynamic column lists including domain resolution via LEFT JOINs, and outputs the data as batched JSON (200 rows per batch to stay under sqlcmd's 1MB output limit). Only active records are exported (WHERE Status_ID = 1).
If a domain value cannot be matched to any record in the referenced entity (by Code, Name, or {Code} Name format), the field is left empty and a warning is shown.