Add custom work item type data model
Issue: [BE] Add model and table for custom work item t... (#581932 - closed)
What does this MR do and why?
This code change adds a new feature that allows users to create custom work item types (like custom issue types, task types, etc.) within their organizations or namespaces.
The main addition is a new database table and corresponding model called "Custom Type" that stores user-defined work item categories. Each custom type has a name, an icon, and belongs to either an organization or a namespace (but not both). The system includes validation to ensure names are unique within their scope and that each type has a proper parent.
The custom types can either be completely new or converted from existing system-defined types. When displaying these types, they delegate most of their behavior to a base type (defaulting to "issue" type) until more customization features are added later.
The database changes include creating the main table with indexing for performance, and setting up foreign key relationships to determine ownership of the custom work item type (organization or namespace)
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
-
Run the migration
bin/rails db:migrate -
Create some records from the rails console and test model methods
Example:
=> WorkItems::TypesFramework::Custom::Type.create(name: 'Stories', namespace_id: 1, icon_name: 1, converted_from_system_defined_type_identifier: 1) => WorkItems::TypesFramework::Custom::Type.create(name: 'Feature', organization_id: 1, icon_name: 5, converted_from_system_defined_type_identifier: 1) => custom_wit = WorkItems::TypesFramework::Custom::Type.find(1) => custom_wit.to_global_id => custom_with.system_defined_type => custom_with.converted_from_system_defined_type
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.