Until now, when forking an environment (or duplicating a project from the dashboard), resources under the newly created environment were assigned new IDs. This included models, fields, fieldsets, records, blocks, menu items, plugins, filters and media assets.
Starting from today, every resource will keep their original ID on the forked environment (or duplicated project). For instance, given a model "Blog Post" with ID "12345"
in the primary environment, once the environment is forked, a new model "Blog Post" with the same ID "12345"
will be present in the new sandbox environment.
We are so excited about this new feature, as it greatly enhances the developer experience. It makes the adoption of an environment-based workflow even easier, as the cloned environment is indistinguishable from the original one. Migrations are simpler to write, as you can safely rely on the IDs to pick resources, and the same applies to any third-party application that communicates with your DatoCMS project.
This change will also allow us to start working on another very requested feature by community: auto-generation of migration scripts by diffing two different environments!
⚠️ PS. Since now IDs are immutable cross-environment, take extra precaution at selecting the right environment when you're ie. deleting any resource via our Content Management API! The same ID is present on multiple environments, so your API call will work even if you're not targeting the environment you had in mind!