Skip to content
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

Have a consistent API for confirming if a DataObject is ready for database operations #10332

Open
8 tasks
GuySartorelli opened this issue May 23, 2022 · 2 comments

Comments

@GuySartorelli
Copy link
Member

There are time when code that manipulates or even fetches data from some DataObject could be run during or before dev/build. For those situations, we need to confirm that the relevant table(s) exist in the database, and that all of the necessary database columns exist in those tables.

Currently in those situations we have a variety of different solutions. Max identified some of these in silverstripe/silverstripe-graphql#445 (comment) which I have included in a list further down in this description. We should have a unified way of performing these checks.

Reasons to making these checks unified:

Ways these checks are currently being performed

These have been found using github search, which I have noticed misses stuff sometimes, so this may not be a complete list. This does not include anything included inside tests or test classes.

Acceptance Criteria

  • A preferred way of performing the checks is identified, with clearly documented reasoning.
  • This works correctly regardless of any changes to code that will affect the database
    • Prior to the first dev/build
    • adding a new Extension to a DataObject after the first dev/build
    • adding new fields or relations to a DataObject after the first dev/build
    • changing the $table_name config for a DataObject after the first dev/build
  • All identified areas that need this check use the new method
  • Any old now-unused methods are deprecated

PRs

@maxime-rainville
Copy link
Contributor

Didn't have time to get this into CMS5.

@jakxnz
Copy link
Contributor

jakxnz commented Sep 17, 2024

This is great. Let's try and find the next most immediate minor to include this in!

@GuySartorelli GuySartorelli added this to the Silverstripe CMS 6.1 milestone Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants