Delete Data Type
Delete DataType Mutation
Deletes an existing data type definition from the system.
Arguments
id
ID!
The ID of the data type to delete
Return Type
DataTypeDeletePayload! - Confirmation of the delete operation.
Return Fields
DataTypeDeletePayload:
deletedID
ID
The ID of the deleted data type
Usage Example
mutation {
deleteDataType(id: "dt_123456789") {
deletedID
}
}JavaScript Example
Important Considerations
Soft vs Hard Delete
The pyck system implements soft deletes by default, meaning:
The data type record is marked as deleted (
deletedAttimestamp is set)The data type definition remains in the database for audit purposes
The data type will not appear in normal queries
Entities using this data type retain their data but lose schema validation
Dependency Impact
Before deleting a data type, consider:
Active Entities: Customers, suppliers, items, or other entities using this data type
Forms and UI: Frontend applications relying on the schema structure
Validation Rules: Business logic that depends on the data type schema
Reports and Analytics: Systems that query data based on the schema
API Integrations: External systems expecting specific data formats
Data Type Usage
Data types are referenced by entities through:
dataTypeID- Direct reference to the data typedataTypeSlug- String-based reference for easier identificationSchema validation applied to the
datafield of entities
Permissions
Data type deletion typically requires:
Administrative or system architect privileges
Proper authorization for the tenant/organization
Understanding of system-wide impact of the deletion
Compliance with data governance policies
Error Scenarios
The mutation may fail in these cases:
Not Found: Data type ID doesn't exist
Permission Denied: Insufficient privileges to delete data types
Constraint Violations: Entities are actively using this data type
System Data Types: Attempting to delete built-in or system data types
Default Data Types: Trying to delete data types marked as default
Pre-Deletion Checklist
Before deleting a data type:
Identify Usage: Query all entities using this data type
Migration Plan: Plan how to handle existing entities
Backup Schema: Save the JSON schema definition
Stakeholder Approval: Get approval from business stakeholders
System Testing: Test system behavior after deletion
Rollback Plan: Prepare to restore if issues arise
Migration Strategies
Entity Reassignment
Data Preservation
Best Practices
Impact Analysis: Thoroughly analyze dependencies before deletion
Gradual Migration: Move entities to other data types first
Communication: Notify all stakeholders of the planned deletion
Documentation: Document reasons for deletion and migration steps
Testing: Test system behavior in non-production environments
Monitoring: Monitor system health after deletion
Alternative Approaches
Instead of deletion, consider:
Deprecation: Mark data type as deprecated but keep it available
Versioning: Create new versions instead of deleting old ones
Archiving: Move unused data types to an archived status
Replacement: Create replacement data types before deleting old ones
Recovery Options
If a data type is accidentally deleted:
Soft Delete Recovery: Clear the
deletedAttimestamp to restoreSchema Restoration: Recreate the data type with the same JSON schema
Entity Reassignment: Update entities to use the restored data type
Validation Repair: Fix any validation issues that occurred during the outage
Related Operations
After data type deletion, you may need to:
Update documentation and API references
Modify form generation systems
Update validation logic in applications
Revise data import/export processes
Adjust reporting and analytics queries
Monitoring and Alerts
Consider setting up monitoring for:
Entities without valid data type references
Validation errors due to missing schemas
Performance impacts from schema changes
Failed operations due to missing data types
Last updated
Was this helpful?
