You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The directus-sync extension is a valuable tool, but manipulating JSON directly can be cumbersome and lacks autocompletion for TypeScript users. To address this, I propose a TypeORM-inspired approach for data migration in Directus.
This feature would introduce specific decorators for TypeScript classes that inherit from a base class. This base class would have a method for serializing the model into a JSON file compatible with the directus-sync migration format. These decorators would provide autocompletion and type safety, streamlining the migration process.
I'm eager to contribute to this feature and would appreciate any guidance on ensuring compatibility with the current directus-sync implementation. I'm happy to discuss further details and explore the best approach for integration.
The text was updated successfully, but these errors were encountered:
I think the most difficult part will be defining the type of the snapshot. There is a partial type here, but it doesn't cover all field types.
Nevertheless, this will be of great value for coders who prefer to define the structure of Directus with TypeScript rather than using the interface.
Initially, we can focus on the push and diff commands as they are the most valuable features and the most straightforward. As you said, we need to serialize the TypeScript objects to JSON and then use the tool as usual.
In the future, we can consider pulling the configuration into TypeScript format. This can be useful if coders want to manage an existing Directus instance from TypeScript. We could use TSMorph
The first step is to write the TypeScript definition of the configuration pulled from Directus (collections and snapshot). We can think about how to integrate this with the rest of the tool later.
Hi,
The directus-sync extension is a valuable tool, but manipulating JSON directly can be cumbersome and lacks autocompletion for TypeScript users. To address this, I propose a TypeORM-inspired approach for data migration in Directus.
This feature would introduce specific decorators for TypeScript classes that inherit from a base class. This base class would have a method for serializing the model into a JSON file compatible with the directus-sync migration format. These decorators would provide autocompletion and type safety, streamlining the migration process.
I'm eager to contribute to this feature and would appreciate any guidance on ensuring compatibility with the current directus-sync implementation. I'm happy to discuss further details and explore the best approach for integration.
The text was updated successfully, but these errors were encountered: