Problem/Motivation

Follow-up to #3411490: Replace array-based DB Schema API with a value object structure.

Proposed resolution

  • Convert core hook_schema() implementations of regular modules to use Drupal\Core\Database\SchemaDefinition.
  • Add validation to ensure 'length' is passed for varchar columns
  • Postpone conversion of schemata provided by test modules to a next issue

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3557481

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mondrake created an issue. See original summary.

mondrake’s picture

Status: Active » Postponed
mondrake’s picture

Issue summary: View changes
mondrake’s picture

Issue summary: View changes

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

mondrake’s picture

Status: Postponed » Active
mondrake’s picture

Status: Active » Needs review
mondrake’s picture

Assigned: Unassigned » mondrake
Status: Needs review » Needs work

Needs some tuning. On that.

mondrake’s picture

Assigned: mondrake » Unassigned
Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

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.

mondrake’s picture

Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new98 bytes

The Needs Review Queue Bot tested this issue. The merge request has merge conflicts and cannot be merged. 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.

amateescu’s picture

Found a few issues in the MR, some of them blocking, but in general it's very hard to review such a large change. How about splitting it into conversions for test and non-test modules.

mondrake’s picture

Assigned: Unassigned » mondrake

#14 yes, good idea, will do

mondrake’s picture

Title: Convert hook_schema() implementations to SchemaDefinition » Convert hook_schema() implementations to SchemaDefinition - regular modules

mondrake changed the visibility of the branch 3557481-convert-hookschema-implementations to hidden.

mondrake’s picture

Assigned: mondrake » Unassigned
Issue summary: View changes
Status: Needs work » Needs review

Applied the suggestions and reduced scope of the MR here to converting schemata of regular, non-test, modules.

mondrake’s picture

Issue summary: View changes
daffie’s picture

Status: Needs review » Needs work
mondrake’s picture

Status: Needs work » Needs review

Thanks

daffie’s picture

Status: Needs review » Needs work

Last nitpick, for the rest is it RTBC for me.

mondrake’s picture

Status: Needs work » Needs review
daffie’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.
All my remarks are addressed.
For me it is RTBC.

amateescu’s picture

Status: Reviewed & tested by the community » Needs work

The new MR looks much better and easier to review, thanks! Left a few review points, one of them being that we're missing an update hook for the wid column.

mondrake’s picture

Status: Needs work » Needs review

added update function + update path test, reverted ModuleInstaller changes to be postponed to the follow up.

mondrake’s picture

the update path test for dblog is green on all dbs. mysqli has some test failures but seem unrelated to me.

mondrake’s picture

Assigned: Unassigned » mondrake
Status: Needs review » Needs work

couple things to check on the update path

mondrake’s picture

Assigned: mondrake » Unassigned
Status: Needs work » Needs review
meeni_dhobale’s picture

Tested MR !16910 on main/PHP 8.5 against both pdo_mysql and mysqli it applies cleanly, all tests pass, and I verified via DDL diff (old site + patch + updatedb vs. fresh install) that no module besides dblog needs an update hook.

Also confirmed dblog_update_11500's unsigned fix addresses a real, live schema discrepancy (checked against the legacy driver).

Looks good to me.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

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.

mondrake’s picture

Status: Needs work » Needs review

rebased

mondrake’s picture

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

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.

mondrake’s picture

Status: Needs work » Needs review

Rebased.

amateescu’s picture

Reviewed again and posted a few more comments on the MR.

mondrake’s picture

Assigned: Unassigned » mondrake
Status: Needs review » Needs work

let's fix based on those two comments. on that.

mondrake’s picture

Assigned: mondrake » Unassigned
Status: Needs work » Needs review

thanks, made the changes suggested.

amateescu’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +11.5.0 release priority

Looks great to me now! We should really try and get this into 11.5 so we can showcase the new API and set the right example for new code.

mondrake’s picture

MR!16910 is the one RTBCed.

larowlan’s picture

Left some comments but keeping at RTBC

mondrake’s picture

Status: Reviewed & tested by the community » Needs work
mondrake’s picture

Status: Needs work » Needs review

Addressed @larowlan input, and reverted the accidental removal of a couple of asserts.

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

The recent changes look good to me :)

meeni_dhobale’s picture

I have retested the new current changes and it looks good to me. MR applies cleanly and all test passes clean. Tried to find out the edge cases where it might fail but didn't find any at my end. It looks good to me as well. RTBC.

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new91 bytes

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.

mondrake’s picture

Status: Needs work » Needs review

Rebased and added a couple of more validations for duplicate table in schema and duplicate column in table, that we missed earlier, as found in https://git.drupalcode.org/project/drupal/-/merge_requests/16823#note_23...

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Still looking good :)