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
chore: use db model instead of content type #19563
Conversation
This comment was marked as spam.
This comment was marked as spam.
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.
Cool! I think this causes problems for single-types though. Strangely it is still able to fetch them but I get errors when selecting different versions:
I think it is related to this line:
strapi/packages/core/content-manager/server/src/history/controllers/history-version.ts
Line 11 in 7711203
const isSingleType = strapi.getModel(contentTypeUid).kind === 'singleType'; |
Not sure the API works the same for models.
packages/core/content-manager/server/src/history/models/history-version.ts
Outdated
Show resolved
Hide resolved
createdBy: { | ||
type: 'relation', | ||
relation: 'oneToOne', | ||
target: 'admin::user', | ||
useJoinTable: false, | ||
}, |
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.
is it necessary to use a join table for the created by field?
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.
Do you think it would be? Here it's false, and for normal content types it's false as well
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.
didn't select the right section 😓 I think the attribute is correctly set up and will not use a join table, but there is a message about jointable being optional and didn't get why 🤔
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.
Ah I see. The comment is because TS wanted us to provide a joinTable property (not sure about the name exactly). But it shouldn't be required when useJoinTable is false. The type isn't smart enough for that yet, that's why we expect a TS error here
What does it do?
Removes the history version content type. Registers a history version model instead.
Why is it needed?
We want to stop using content types for internal stuff, as it doesn't need the CM, CTB, review workflows etc.
How to test it?
Everything should work as it did before