Hi OS Community,
I have a table in my main screen that only shows the Version Nr 1 of a project, when the user clicks in the ProjectName it opens a popup where the user can select the version he wants to be redirected to.
The problems I am facing are:
Hi @Declan Cole ,
1) if you are creating a new record in the project entity for every new version, I'm not really getting why you need the version entity, the project itself will hold your versions, right. so just have a versionnumber in there.
2) to facilitate easily selecting the last version of every project, add a boolean to your entity IsLastVersion. Whenever you add a new version, set it to False on the one that no longer is the last, and set it to True on the new one.
Dorine
You are right, I don't know what I was thinking, thanks for pointing that out.
And the number 2 point is also a great and simple solution to solve my problem, thanks a lot Dorine.
Just to make this more complete, there is a real good case to make for having a Project and ProjectVersion entity, but in that case, you should not add a new project record every time you add a new version. The project would then contain information that doesn't change with every version.
That would be a one to many (so reference attribute ProjectId in ProjectVersion), and you could still use an IsLastVersion Boolean on the version entity, or alternatively you take the Espace + EspaceVersion as an example, and you have a reference attribute in Project to ProjectVersion, named LastVersionId.
Hi @Declan Cole
I don't understand why you did this. If you want to add a project against a version then why are you trying to add the project id in the version table?
Hi Vijay,
because when creating a new version, in reality it is also creating a new record in the project entity. I did it this way because every project can have 20 or more different version and I want each one to be stored as a new project record since it will store information related to that project and related to that specific version.
This is how your data model looks like. Please consider having a ProjectVersion entity having (Id, ProjectId, VersionId)
Or Just like this.
But even when I changed the database structure I am still facing the same problems. For example, I want to display the ProjectName, Description and Creation Date in the main screen table for the latest version of each Project. The agreggate feeding that table with group by: ProjectGroupId and Max of VersionNumber is not giving me the correct output, do you have any solution for this?
Hello Declan,
Vijay is correct, why you are using key of both entities into each other.
By the way I see this relation is 1 to many relationship (one project have multiple versions) so you can use project Id only into Version entity.
You can make all fields that will be changed with each version into version entity and make project entity contains only ProjectId and ProjectName
I think you should try something like this