-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(comp.backend): ADR - Enable filtering for component instance without support group or service #289
base: main
Are you sure you want to change the base?
docs(comp.backend): ADR - Enable filtering for component instance without support group or service #289
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesnt it make most sense to:
Create a "system" support group & service "unwkown" with the DB init and actually set default values on the DB for support group and service.
We may need to check if that would work.
Support Group and Service are a many to many relationship. So we have to use a DB trigger to insert a default entry in the join table. Once we assign a Service to a real Support Group, we need a trigger, that will remove the default assignment again. |
Well I disagree, I did not talk about the relation between Support Group and Service but rather having a default Support Group with a default relation to a default Service. This relationship actually never changes. What changes potentially is the service a component instance is attached to. For this, we define a default value for the created default service. |
This: insert into heureka.Service (service_name) values ('Unkown');
insert into heureka.SupportGroup (supportgroup_name) values ('Unkown');
insert into heureka.SupportGroupService (supportgroupservice_service_id, supportgroupservice_support_group_id) values (1, 1);
create table if not exists ComponentInstance
(
componentinstance_id int unsigned auto_increment
primary key,
componentinstance_ccrn varchar(2048) not null,
componentinstance_count int default 0 not null,
componentinstance_component_version_id int unsigned not null,
componentinstance_service_id int unsigned default 1 not null,
componentinstance_created_at timestamp default current_timestamp() not null,
componentinstance_deleted_at timestamp null,
componentinstance_updated_at timestamp default current_timestamp() not null on update current_timestamp(),
constraint id_UNIQUE
unique (componentinstance_id),
constraint name_service_unique
unique (componentinstance_ccrn, componentinstance_service_id) using hash,
constraint fk_component_instance_component_version
foreign key (componentinstance_component_version_id) references ComponentVersion (componentversion_id)
on update cascade,
constraint fk_component_instance_service
foreign key (componentinstance_service_id) references Service (service_id)
on update cascade
); |
And Services have a default relationship to that SupportGroup too? So we can detect Services without SupportGroup |
Yes that would make sense to me |
Agreement? |
I agree with having a Unknown Service with an Unknown SupportGroup that we can attach to a ComponentInstance, that does not have a service. But what about the Service and Support Group scenario? |
I agree that's business logic we need to add. I would add an event handler that is checking for that and removing the relationship if any other group is present. |
We agreed that the logic should be in the app layer even though it would be simpler in the DB layer |
Description
Our current database schema enforces having a service id for each component instance, which could potentially present problems if we decide to change this requirement in the future. The relationship between component instances, services, and support groups is complex, with a many-to-many relationship between service and support group. This setup may lead to challenges in managing and maintaining the data.
What type of PR is this? (check all applicable)
Related Tickets & Documents
Added tests?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Added to documentation?
Checklist