Currently it does not seem possible to add a new index to a schema generated by the storage_schema. Obviously the class can be overridden but that really doesn't solve the issue.

As an actual use case I am working on porting the scheduler module and the publish and unpublish fields now exist as base fields on the node table. If I was too sub class the storage_schema it would mean that only one module could ever really be used. It maybe that I am simply missing something but the lack of an alter or event?

Comments

marcingy’s picture

Version: 8.1.x-dev » 8.0.x-dev
berdir’s picture

Assigned: Unassigned » plach

Let's see what @plach has to say.

Wondering if fields added like that should really end up on the base table...

The field schema can define indexes, but then you'd have to create your own field type.

We discussed about an alter hook many times and weren't sure if it is a good idea or not, but if we want to, adding it would be easy and possible any time.

plach’s picture

Status: Active » Closed (duplicate)
Related issues: +#2258347: Consider adding hook_entity_schema_alter()

Wondering if fields added like that should really end up on the base table...

Well, that's exactly the kind of use case I had in mind for dynamically added base fields. Not sure whether bundle fields would make more sense as scheduling can be enabled per content type, but from the top of my head I see nothing wrong if they end up being base fields.

Anyway I think this is a duplicate of #2258347: Consider adding hook_entity_schema_alter().

plach’s picture

Assigned: plach » Unassigned
marcingy’s picture

Ah yes indeed that will totally suit what I need, and google failure didn't uncover that issue!