DB_Model Relation 1:1

Hi,
how can I create a Relation 1:1 between two classes/models. It’s a type of inheritance.
Example: Person 1 : 1 Student, Person 1 : 1 Teacher, Person 1 : 1 Emploee

Hey Renlite,

Thank you for trying our new platform and for your feedback.

You can do this to handle 1:1 relation :

for example, you can create a table call it Person and create a field teacher who is also a Person and Qodly will automatically add a Person Selection you can rename it to students

Then for the person if it’s a teacher you can get the students using person.students and if the person is a student you can get the teacher using person.teacher.

Ayoub

1 Like

Hello Ayoub,
thank you for the explenation and example!
I think this does not fullfill the relation 1 : 1 in a complex model.
As you wrote Person == Teacher but Person == Student and Person == Employee and so on, too. All the children of Person share the attributes (firstName, lastName) of Person and should inherit the attributes from Person. The children have their own specific attributes and their own relationships (Teacher n:n Student), (Employee n : 1 Company).
Or Teacher could inherit from Employee and Employee from Person. Person ← Employee ← Teacher, Person ← Student
Regards

i see what you are looking for.
The 1:1 relation (Inheritance) is not supported yet.
I will create a feature request for this demand.

Ayoub

Thanks for the request.