- Issue created by @mondrake
- Assigned to mondrake
- Merge request !5987Replace array-based Schema API with a value object structure → (Open) created by mondrake
- Status changed to Needs review
12 months ago 3:36pm 2 January 2024 - 🇮🇹Italy mondrake 🇮🇹
Here's a MR that tries to do the minimum possible:
- add all the relevant value objects to the
Drupal\Core\Database\SchemaDefinition
namespace - adds a converter from the new API to the old API + a basic test, and makes adjustments so that we can use the new API in
hook_schema()
or other functions without impacting the database driver code (that will be huge, but follow ups). In practice the new API is converted to the old one on the fly. - added a couple of example conversions to demonstrate the new API, for
system_schema()
andDrupal\Core\Batch\BatchStorage::schemaDefinition(). I would leave conversions to followups, too, because it's a lot of work, especially for cases where the old array structure is built dynamically.
Looking forward to reviews!
- add all the relevant value objects to the
- Status changed to Needs work
12 months ago 8:01am 3 January 2024 - 🇮🇹Italy mondrake 🇮🇹
Let’s change the trait to an abstract class.
- Issue was unassigned.
- Status changed to Needs review
12 months ago 1:46pm 3 January 2024 - 🇮🇹Italy mondrake 🇮🇹
For review. Invocation of
hook_schema
now return by default the array version of the schema definition, for BC. Code needs to explicitly opt-in to get Table objects instead or array shapes. In the future this will change but this allows to manage transition to the new approach. - Status changed to Needs work
12 months ago 2:48pm 3 January 2024 - Status changed to Needs review
12 months ago 3:39pm 3 January 2024 - Status changed to Needs work
10 months ago 2:00pm 4 March 2024 The Needs Review Queue Bot → tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
- 🇺🇸United States bradjones1 Digital Nomad Life
Worth noting we're doing something similar but not quite the same over at 📌 Adding GIN and GIST indexes to PostgreSQL databases RTBC .
Per some feedback in Drupal Slack today, it sounds like the ideal state would be to use events a la ✨ Use events in Database Schema operations Active but we're postponed enough as it is on related issues. At the very least, this demonstrates how we can use objects in some circumstances inside of "ArrayPI" without breaking BC and enabling innovation.