magento / architecture

A place where Magento architectural discussions happen
274 stars 154 forks source link

DB Information Schema - COLUMNS #318

Closed jean-bernard-valentaten closed 5 years ago

jean-bernard-valentaten commented 5 years ago

Problem

This is a subset of #264 , covering only COLUMNS and TABLES interfaces.

Different RDBMS return Information Schema (metadata) information in different format. Magento framework should allow to switch between different implementations in order to support those different versions of DBs, as well as differences between versions.

Solution

Introduce granular interfaces, based in Information Schema standard (looking into MySQL and MariaDB definitions in this scope, links are in the document). Application can switch between different implementation based on the profile.

larsroettig commented 5 years ago

@akaplya can you review it pls it looks good to me

larsroettig commented 5 years ago

Kann be merged told me @akaplya

melnikovi commented 5 years ago

Feedback after review with @akaplya, @buskamuza and @fascinosum

Also need to consider

larsroettig commented 5 years ago

@melnikovi in PHP we do not have enum type to archive this we need to use a library like https://github.com/spatie/enum or https://docs.spatie.be/enum/v2/introduction/.

melnikovi commented 5 years ago

@larsroettig I was referring to this https://www.php.net/manual/en/class.splenum.php.

jean-bernard-valentaten commented 5 years ago

@melnikovi I have a couple of questions about you considerations:

Introducing enums for collation and charset

Fine with me, but bear in mind that these vary from RDBMS to RDBMS, thus those enums would have to be located in the DBAL.

What should be return type of getDefaultValue?

Can you elaborate what you mean exactly? Imho the return type of getDefaultValue should be tied to the type of column but if you want it to be a generic type, I'd suggest making it ?string. Is that what you are trying to say?

What should be return type of getOnUpdate?

What do you propose?

jean-bernard-valentaten commented 5 years ago

Introduce enum for engine. Need to think what MySQL engines do we need to support and create enum based on that

I added that to the proposal. We may not be able to use SplEnum though as it is contained in a PECL package only.

Need to remove TYPE from column classes

I removed them as requested

Remove InformationSchema\Table\IntColumn:: getType and create different classes instead

That was already done, there are type specific classes for all ANSI-SQl variants of integer.

melnikovi commented 5 years ago

Open questions will be finalized in subsequent proposals.