Hi @wanglj
In my opinion a more flexible structure is to have a type for companies and one specific type for job history. I’m using GraphQL type here and you can use dql equivalent:
type Person {
PersonID: ID!
name: String
workHistory: [WorkHistory]
}
type Company {
CompanyID: ID!
name: String!
workHistories: [WorkHistory]
}
type WorkHistory {
WorkHistoryID: ID!
company: Company! @hasInverse(field: "workHistories")
person: Person @hasInverse(field: "workHistory")
date: Date
}
Now with this schema I do not need to store which work place is the first and I can get the result using a query.
What you can get easy with this structure(LinkedIn Example):
1- First place somebody worked at:
query {
getPerson(PersonID: "0x2") {
name
workHistories(first: -1) {
WorkHistoryID
company {
CompanyID
name
}
}
}
}
2- Workers of specific company:
query {
getCompany(ComponayID: "0x1") {
CompanyID
workHistories {
WorkHistoryID
person {
name
}
}
}
}