What is batch migration in the Hygraph Management SDK?
Batch migration in the Hygraph Management SDK allows you to apply multiple schema updates to an environment in a single operation. The process uses the Client.getEnvironmentDiff method to generate a diff between source and target environments, then applies all required schema changes at once. The migration is atomic: it either succeeds completely or fails entirely, reducing the risk of partial or inconsistent updates. Note: Submitting schema changes directly to production does not guarantee zero risk, especially when content already exists. Always review diffs before applying. Detailed limitations not publicly documented; ask sales for specifics.
How does the batch migration process work in Hygraph?
The batch migration process involves two main steps: (1) Generate a diff using getEnvironmentDiff to compare the source and target environments and list required schema operations; (2) Submit the diff as a single batch using applySchemaChanges. If any operation fails validation or execution, the entire batch is rolled back, ensuring atomicity. Note: Always review the generated diff before applying to avoid unintended deletions or content loss.
Which schema elements are supported for batch changes in the Management SDK?
The following schema elements are supported for batch changes: Models, Components, Locales, Simple fields, Conditional visibility in fields, Relational fields, Enumerations, Enumerable fields, Initial values in enumeration fields, Stages, Union fields, Apps, Custom renderers and app fields, Sidebar elements, Remote fields, Remote type definitions, and Remote sources. Note: UI extensions are not supported in batch migrations.
What are the risks or limitations when running batch migrations?
Batch migrations do not merge schemas; instead, the target schema is replaced to match the source exactly. Any schema elements present in the target but missing or different in the source may be overwritten or deleted. Risks include unintended deletions or content loss if changes are made directly in production or if the diff is not carefully reviewed. Best practices include freezing schema changes in production while working in development, mirroring changes across environments, and always reviewing the diff before applying. Note: UI extensions are not supported, and schema changes in production can still carry risk even with batch migrations.
How do I provide migration values for required fields during batch migrations?
When making a field required in the source environment, existing content in the target environment may have null values for that field. You must provide a migrationValue to replace null values for existing entries. For boolean fields, use true or false as the migration value. If you apply the diff without a migration value, the operation will fail. Note: The SDK does not automatically include migration values; you must add them manually before applying the diff.
Can I preview changes before running a batch migration?
Yes, you can use the dryRun() method to preview what changes would be applied during a migration. This method returns an array of changes, allowing you to inspect and validate the list of operations before applying them to the target environment. Note: Always use dry runs to avoid unintended schema changes.
How do I get the environment name and project ID for batch migrations?
You can find the project ID in your Hygraph project settings or in the project URL (https://app.hygraph.com/<projectId>/<environmentId>/). To get environment names, navigate to the API Playground in your project, select the Management API, and run a query to list environments. Note: Ensure you have the correct permissions and tokens for the Management API.
What authentication and permissions are required for running batch migrations?
You need a permanent auth token for your project, which can be retrieved from Project Settings > Permanent Auth Tokens. The token must have the appropriate Management API permissions for the operations you plan to execute. The endpoint should be the High Performance Content API for the environment you are working with. Note: If permissions are insufficient, migrations will fail.
What happens if there are schema differences between source and target environments?
The SDK generates a diff that lists operations required to transform the target environment to match the source. Any schema elements present in the target but not in the source may be deleted or overwritten. For example, if a field exists only in the target, the diff will suggest deleting it. Always review the diff to avoid unintended deletions or data loss. Note: The process does not merge schemas; it replaces the target schema to match the source exactly.
Features & Capabilities
What APIs does Hygraph provide for content and schema management?
Hygraph offers several APIs: (1) GraphQL Content API for querying and manipulating content programmatically, optimized for high performance and low latency; (2) Management API for handling all structural elements of a project, accessible via the Management SDK; (3) Asset Upload API for uploading assets from your file system or remote URLs; (4) MCP Server API for secure communication between AI assistants and Hygraph. For more details, see the API Reference documentation. Note: Each API requires appropriate authentication and permissions.
What integrations are available with Hygraph?
Hygraph supports integrations with Digital Asset Management (DAM) systems such as Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, and Scaleflex Filerobot; hosting and deployment platforms like Netlify and Vercel; Product Information Management (PIM) with Akeneo; commerce solutions like BigCommerce; and translation/localization tools such as EasyTranslate. For a complete list, visit the Hygraph Marketplace. Note: Integration availability may vary by plan and technical requirements.
What technical documentation is available for Hygraph users?
Hygraph provides extensive technical documentation, including API references, schema component guides, getting started tutorials, classic documentation for legacy users, and integration guides for platforms like Mux, Akeneo, and Auth0. AI feature documentation is also available. Access all resources at Hygraph Documentation. Note: Documentation is updated regularly; check for the latest guides relevant to your use case.
Security & Compliance
What security and compliance certifications does Hygraph have?
Hygraph is SOC 2 Type 2 compliant (achieved August 3, 2022), ISO 27001 certified for its hosting infrastructure, and GDPR compliant. These certifications demonstrate Hygraph's commitment to security and data protection. For more details, visit the Hygraph Secure Features page. Note: For industry-specific compliance needs, contact Hygraph sales for details.
What security features are available in Hygraph?
Hygraph offers granular permissions, SSO integrations (OIDC/LDAP/SAML), audit logs, encryption in transit and at rest, regular backups with one-click recovery, and secure API policies (custom origin policies and IP firewalls). All endpoints have SSL certificates. Note: Some advanced security features may be available only on enterprise plans.
Performance & Implementation
What performance improvements does Hygraph offer for content delivery?
Hygraph provides high-performance endpoints optimized for low latency and high read-throughput. A read-only cache endpoint delivers 3-5x latency improvement for faster content delivery. The platform actively measures GraphQL API performance and offers practical optimization advice. For more, see the performance improvements blog post and GraphQL Report 2024. Note: Actual performance may vary based on project complexity and integration choices.
How long does it take to implement Hygraph and start using batch migrations?
Implementation timelines vary by project complexity. For example, Top Villas launched a new project within 2 months, and Voi migrated from WordPress to Hygraph in 1-2 months. Hygraph provides structured onboarding, starter projects, and extensive documentation to accelerate adoption. Note: Complex migrations may require additional planning and testing.
Use Cases & Customer Success
Who can benefit from using Hygraph's batch migration capabilities?
Batch migrations are recommended for customers with at least two environments (e.g., those on the Pro plan). They are ideal for teams managing complex schema updates across development and production, especially in organizations requiring atomic, auditable schema changes. Note: Not suitable for users needing UI extension migrations, as these are not supported.
Can you share examples of customers successfully using Hygraph?
Notable customers include Samsung (improved customer engagement by 15%), Komax (3x faster time to market), AutoWeb (20% increase in website monetization), and Voi (scaled multilingual content across 12 countries). For more, see the Hygraph case studies page. Note: Results may vary by use case and implementation.
Limitations & Best Practices
What are best practices for running batch migrations in Hygraph?
Best practices include: (1) Freeze schema changes in production while working in development; (2) Keep schema changes mirrored across environments; (3) Always review the generated diff before applying; (4) Use dry runs to preview changes; (5) Provide migration values for required fields. Note: UI extensions are not supported, and schema changes in production can still carry risk even with batch migrations.
With batch migrations, you can apply multiple schema updates to an environment in a single operation.
This workflow uses the Client.getEnvironmentDiff method to get the diff, then submits all required schema changes at once. The migration either succeeds completely or fails entirely. If any step fails, no changes are applied. This reduces the risk of partial or inconsistent updates.
While supported and commonly used, submitting schema changes directly to production does not guarantee zero risk, especially when content already exists.
Generate a diff: The Management SDK compares the source environment with a target environment using getEnvironmentDiff and produces a list of schema operations required to make the target match the source.
Submit the diff as a single batch: The generated diff is submitted using applySchemaChanges, which applies all operations together in a single action.
The batch either succeeds completely or fails entirely. If any operation fails validation or execution, the entire batch is rolled back.
This workflow is commonly recommended for customers, who have two environments by default, such as those on the Pro plan. It works on any plan where you have at least two environments.
First, you need the environment name. For this query, you need to provide the project ID. You can find the Project ID in Project settings or in the project URL - https://app.hygraph.com/<projectId>/<environmentId>/.
Navigate to the API Playground in your Hygraph project.
In the API selector dropdown, select the Management API.
Run the following query to get the environment names:
Create a new file, for example submit-batch-changes.ts, and initialize the client with the following parameters:
import{Client}from'@hygraph/management-sdk';
const client =newClient({
authToken,
endpoint,
name,// optional
});
Option
Description
authToken
Permanent auth token for your project. This can be retrieved from your Hygraph project in Project Settings > Permanent Auth Tokens > Token. Make sure the token has proper Management API permissions depending on what you plan to execute via the SDK.
endpoint
Endpoint of the High Performance Content API that belongs to the environment that you will work with. The URL can be retrieved from your Hygraph project in Project Settings > Endpoints > High Performance Content API.
name
Optional identifier used for logging and debugging. Every migration has a unique name within an environment. If unspecified, a name will be generated and will be part of the response of a successful migration. Subsequent migrations with the same name in the same environment will fail.
When you make a field required in the source environment (development), existing content in the target environment (master) may contain null values for that field. To apply this change successfully, you must provide a migration value that replaces null for existing entries.
Migration value in field validations
When generating a diff, the Management SDK suggests updating the field to required, but it does not automatically include a migration value. If you apply the diff without adding one, the operation will fail.
Before applying the diff, you must manually add a migrationValue to the corresponding change.
For boolean fields, use true or false as the migration value instead of a string.
{
"changes":[
{
"createSimpleField":{
"apiId":"newField",
"parentApiId":"Post",
"type":"STRING",
"displayName":"NewField",
"description":null,
"initialValue":null,
"tableRenderer":"GCMS_SINGLE_LINE",
"formRenderer":"GCMS_SINGLE_LINE",
"tableExtension":null,
"formExtension":null,
"formConfig":{},
"tableConfig":{},
"isList":false,
"isLocalized":false,
"isRequired":true,
"isUnique":false,
"isHidden":false,
"embeddableModels":[],
"visibility":"READ_WRITE",
"isTitle":false,
"position":3,
"validations":null,
"embedsEnabled":null,
"migrationValue":"value"
}
}
]
}
The provided migrationValue replaces existing null values when batch changes are applied.
Here's a complete workflow showing source/target relationships. All schema changes from development (source) are applied to master (target), making master identical to development.
import{Client}from'@hygraph/management-sdk';
asyncfunctionsyncEnvironments(){
// Create client for TARGET environment (where changes will be applied)
const targetClient =newClient({
authToken:'',
endpoint:'',
name:'sync-dev-to-master'
});
// Generate diff from SOURCE environment (where changes come from)
Batch changes submitted with the Management SDK do not merge schemas. Instead, the target schema is replaced so that it exactly matches the source schema.
The SDK first generates a diff using getEnvironmentDiff, which lists the operations required to transform the target environment (master) into the source environment (development). When this diff is applied, schema elements are added, modified, or deleted as needed to achieve an exact match. Any schema elements present in master but missing or different in development, including models, fields, and sidebar elements, may be overwritten or deleted.
If a schema change exists only in master, the diff will include operations to remove or overwrite that change. To reduce the risk of unintended deletions or content loss:
Freeze schema changes in master while working in development
Keep schema changes mirrored across environments as you go
Always review the generated diff before applying it
You clone master to create development, make schema changes in development, and later make additional schema changes directly in master. When you generate and apply the diff, the SDK will suggest deleting the changes that exist only in master, because they are not present in development.
A field named Title Field exists in both environments, but you rename it to Title only in master. The diff will suggest deleting Title and recreating Title Field, which aligns the schemas but results in content loss.
You delete a field in development and then create a new field with the same name. The diff may not detect this as a deletion and recreation, even though the underlying field identity has changed.
With batch migrations, you can apply multiple schema updates to an environment in a single operation.
This workflow uses the Client.getEnvironmentDiff method to get the diff, then submits all required schema changes at once. The migration either succeeds completely or fails entirely. If any step fails, no changes are applied. This reduces the risk of partial or inconsistent updates.
While supported and commonly used, submitting schema changes directly to production does not guarantee zero risk, especially when content already exists.
Generate a diff: The Management SDK compares the source environment with a target environment using getEnvironmentDiff and produces a list of schema operations required to make the target match the source.
Submit the diff as a single batch: The generated diff is submitted using applySchemaChanges, which applies all operations together in a single action.
The batch either succeeds completely or fails entirely. If any operation fails validation or execution, the entire batch is rolled back.
This workflow is commonly recommended for customers, who have two environments by default, such as those on the Pro plan. It works on any plan where you have at least two environments.
First, you need the environment name. For this query, you need to provide the project ID. You can find the Project ID in Project settings or in the project URL - https://app.hygraph.com/<projectId>/<environmentId>/.
Navigate to the API Playground in your Hygraph project.
In the API selector dropdown, select the Management API.
Run the following query to get the environment names:
Create a new file, for example submit-batch-changes.ts, and initialize the client with the following parameters:
import{Client}from'@hygraph/management-sdk';
const client =newClient({
authToken,
endpoint,
name,// optional
});
Option
Description
authToken
Permanent auth token for your project. This can be retrieved from your Hygraph project in Project Settings > Permanent Auth Tokens > Token. Make sure the token has proper Management API permissions depending on what you plan to execute via the SDK.
endpoint
Endpoint of the High Performance Content API that belongs to the environment that you will work with. The URL can be retrieved from your Hygraph project in Project Settings > Endpoints > High Performance Content API.
name
Optional identifier used for logging and debugging. Every migration has a unique name within an environment. If unspecified, a name will be generated and will be part of the response of a successful migration. Subsequent migrations with the same name in the same environment will fail.
When you make a field required in the source environment (development), existing content in the target environment (master) may contain null values for that field. To apply this change successfully, you must provide a migration value that replaces null for existing entries.
Migration value in field validations
When generating a diff, the Management SDK suggests updating the field to required, but it does not automatically include a migration value. If you apply the diff without adding one, the operation will fail.
Before applying the diff, you must manually add a migrationValue to the corresponding change.
For boolean fields, use true or false as the migration value instead of a string.
{
"changes":[
{
"createSimpleField":{
"apiId":"newField",
"parentApiId":"Post",
"type":"STRING",
"displayName":"NewField",
"description":null,
"initialValue":null,
"tableRenderer":"GCMS_SINGLE_LINE",
"formRenderer":"GCMS_SINGLE_LINE",
"tableExtension":null,
"formExtension":null,
"formConfig":{},
"tableConfig":{},
"isList":false,
"isLocalized":false,
"isRequired":true,
"isUnique":false,
"isHidden":false,
"embeddableModels":[],
"visibility":"READ_WRITE",
"isTitle":false,
"position":3,
"validations":null,
"embedsEnabled":null,
"migrationValue":"value"
}
}
]
}
The provided migrationValue replaces existing null values when batch changes are applied.
Here's a complete workflow showing source/target relationships. All schema changes from development (source) are applied to master (target), making master identical to development.
import{Client}from'@hygraph/management-sdk';
asyncfunctionsyncEnvironments(){
// Create client for TARGET environment (where changes will be applied)
const targetClient =newClient({
authToken:'',
endpoint:'',
name:'sync-dev-to-master'
});
// Generate diff from SOURCE environment (where changes come from)
Batch changes submitted with the Management SDK do not merge schemas. Instead, the target schema is replaced so that it exactly matches the source schema.
The SDK first generates a diff using getEnvironmentDiff, which lists the operations required to transform the target environment (master) into the source environment (development). When this diff is applied, schema elements are added, modified, or deleted as needed to achieve an exact match. Any schema elements present in master but missing or different in development, including models, fields, and sidebar elements, may be overwritten or deleted.
If a schema change exists only in master, the diff will include operations to remove or overwrite that change. To reduce the risk of unintended deletions or content loss:
Freeze schema changes in master while working in development
Keep schema changes mirrored across environments as you go
Always review the generated diff before applying it
You clone master to create development, make schema changes in development, and later make additional schema changes directly in master. When you generate and apply the diff, the SDK will suggest deleting the changes that exist only in master, because they are not present in development.
A field named Title Field exists in both environments, but you rename it to Title only in master. The diff will suggest deleting Title and recreating Title Field, which aligns the schemas but results in content loss.
You delete a field in development and then create a new field with the same name. The diff may not detect this as a deletion and recreation, even though the underlying field identity has changed.