-
Notifications
You must be signed in to change notification settings - Fork 36
Add Datamodel and Django Model definitions #4764
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
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.
Testing instructions
Unfortunately there isn't anything specific to test. I would say the best way to go about testing this from the UX side is to play around with forms and queries, and make sure no database table or field related errors occur. Also, for the sp7_only tables, test them out in the query builder.
sp7_only tables:
- Spuserexternalid
- Spattachmentdataset
- UniquenessRule
- UniquenessRuleField
- Message
- Spmerging
- UserPolicy
- Role
- LibraryRole
- UserRole
- RolePolicy
- LibraryRolePolicy
- Spdataset
PR Testing Checklist:
- QB works on tables like Agent, Collecting Object, and Locality
- QB works on the new sp7_only tables
- The Database Schema page works without errors (UserTools->DatabaseSchema) localhost/specify/data-model
- Test out simple agent merging to make sure it still works properly
Query does not work on Spattachmentdataset
KPc3gvrf3N.mp4
Specify 7 Crash Report - 2024-06-11T17_15_46.725Z.txt
Another issue with LibraryRolePolicy
kP77G78M0u.mp4
Specify 7 Crash Report - 2024-06-11T17_21_55.182Z.txt
Other than those 2 tables every other sp7_only table worked for me
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.
Testing instructions
Unfortunately there isn't anything specific to test. I would say the best way to go about testing this from the UX side is to play around with forms and queries, and make sure no database table or field related errors occur. Also, for the sp7_only tables, test them out in the query builder.
sp7_only tables:
- Spuserexternalid
- Spattachmentdataset
- UniquenessRule
- UniquenessRuleField
- Message
- Spmerging
- UserPolicy
- Role
- LibraryRole
- UserRole
- RolePolicy
- LibraryRolePolicy
- Spdataset
PR Testing Checklist:
- QB works on tables like Agent, Collecting Object, and Locality
- QB works on the new sp7_only tables
- The Database Schema page works without errors (UserTools->DatabaseSchema) localhost/specify/data-model
- Test out simple agent merging to make sure it still works properly
I was able to recreate the issue with Spattachmentdataset as @emenslin mentioned.
Also, I get an 'Unable to find SpLocaleConatiner for Role' error when trying to access any of the sp7_only tables in Schema Config
Specify 7 Crash Report - 2024-06-11T21_03_51.256Z.txt
Lastly, there is a small typo on the default label for description on LibraryRole
Thanks @specify/testing, the issues found can be re-tested
This issue will be fixed in a later PR
|
^Could you add a unit test for the dataset? Too encourage it, it is not too complicated. just a couple of lines will do.
that's it^ EDIT: In retrorespect, the above won't work (bc the JSON serializer is specific to query builder). Will need to add the column after passing it through _fieldformat. See |
Some possible table descriptions (feel free to make edits for accuracy/clarification): SpUserExternalId SpAttachmentDataSet UniquenessRule UniquenessRuleField NotificationsMessage SpMerging SpUserPolicy SpUserRole SpRole SpRolePolicy SpLibraryRole SpLibraryRolePolicy SpDataSet Something to consider– we probably shouldn't let anyone aside from institution admins edit the |
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.
PR Testing Checklist:
- QB works on tables like Agent, Collecting Object, and Locality
- QB works on the new sp7_only tables
- The Database Schema page works without errors (UserTools->DatabaseSchema) localhost/specify/data-model
- Test out simple agent merging to make sure it still works properly
- Spattachmentdataset QB fix data field
- Description typo in LibraryRole
Looks great!
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.
Testing instructions
Unfortunately there isn't anything specific to test. I would say the best way to go about testing this from the UX side is to play around with forms and queries, and make sure no database table or field related errors occur. Also, for the sp7_only tables, test them out in the query builder.
sp7_only tables:
- Spuserexternalid
- Spattachmentdataset
- UniquenessRule
- UniquenessRuleField
- Message
- Spmerging
- UserPolicy
- Role
- LibraryRole
- UserRole
- RolePolicy
- LibraryRolePolicy
- Spdataset
PR Testing Checklist:
- QB works on tables like Agent, Collecting Object, and Locality
- QB works on the new sp7_only tables
- The Database Schema page works without errors (UserTools->DatabaseSchema) localhost/specify/data-model
- Test out simple agent merging to make sure it still works properly
Everything within this pr seems to be working great!
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.
Testing instructions
PR Testing Checklist:
- QB works on tables like Agent, Collecting Object, and Locality
- QB works on the new sp7_only tables
- The Database Schema page works without errors (UserTools->DatabaseSchema) localhost/specify/data-model
- Test out simple agent merging to make sure it still works properly
- Spattachmentdataset QB fix data field
- Description typo in LibraryRole
Retested, everything looks good now! 🤸
Fixes #4358 and #2813
This PR adds datamodel and Django model code definitions, instead of relying on reading the 'specify_datamodel.xml' file from Specify 6. So, the schema is now statically defined in our python Django code, instead of dynamically be created at runtime. There is also code that can generated the static python code from the 'specify_datamodel.xml', so we can regenerate the code again in the future easily if we need to. Unit tests have been created to ensure the equivalence between the old and new datamodels. There was another branch
django-schema
that had a lot of code from the development process, but I cleaned it up and simplified it into this branch. There were some problems with adding the sql alchemy schema model classes, this isn't a pressing matter so this is something we can do in the future.Checklist
and self-explanatory (or properly documented)
Testing instructions
Unfortunately there isn't anything specific to test. I would say the best way to go about testing this from the UX side is to play around with forms and queries, and make sure no database table or field related errors occur. Also, for the sp7_only tables, test them out in the query builder.
sp7_only tables:
PR Testing Checklist: