db icon indicating copy to clipboard operation
db copied to clipboard

Separate MariaDB schema

Open ghost opened this issue 7 years ago • 7 comments
trafficstars

@SamMousa commented on Jul 5, 2018, 3:34 PM UTC:

MariaDB is diverging more and more from MySQL.

What steps will reproduce the problem?

Try to use JSON columns with Yii and MariaDB.

What is the expected result?

It should work.

What do you get instead?

It doesn't since MySQL and MariaDB have solved the problem in different ways.

Proposal

  • Create mariadb\Schema and related classes that extend from the MySQL version.
  • When creating a JSON column we must manually add the JSON validation constraint, see this.

Since in MariaDB creating a JSON column results in a LONGTEXT column we need to somehow identify which LONGTEXT columns contain JSON.

  • Create option to detect JSON columns in MariaDB via column comments or name pattern matching.
  • Create option to detect JSON column by parsing constraints via SHOW CREATE TABLE.

Backwards compatibility

Since the DSN remains exactly the same. No one will ever use the MariaDB schema / classes, so any additions to Yii are backwards compatible. For now I propose not doing any detection and just forcing users to set $driverName = 'mariadb'; if they want to use the new classes.

I'm willing to implement this in 2.X, alternatively I'll implement this privately and will merge it into 3.0 when that gets released.

Any feedback is appreciated.

This issue was moved by samdark from yiisoft/yii2#16485.

ghost avatar Oct 09 '18 17:10 ghost

@samdark commented on Jul 5, 2018, 3:58 PM UTC:

I think the best way is if you'll implement it as extension as we do for 3.0 for MSSQL and Oracle: https://github.com/yiisoft/yii2-oracle

ghost avatar Oct 09 '18 17:10 ghost

@SamMousa commented on Jul 5, 2018, 4:13 PM UTC:

Ah, nice, so for 3.0 all drivers are separate? I'll implement an extension for both 2.x and 3.x then i guess :)

ghost avatar Oct 09 '18 17:10 ghost

@samdark commented on Jul 5, 2018, 5:04 PM UTC:

Not all drivers but the ones core team aren't able to maintain themselves.

ghost avatar Oct 09 '18 17:10 ghost

@samdark commented on Jul 5, 2018, 5:05 PM UTC:

When you'll do, feel free to send pull requests that add these to the guide.

ghost avatar Oct 09 '18 17:10 ghost

@cebe commented on Jul 14, 2018, 12:00 AM UTC:

See my comment in #16515, MariaDB should be offically supported.

ghost avatar Oct 09 '18 17:10 ghost

@cebe commented on Jul 16, 2018, 4:24 PM UTC:

For 2.0 this can be an extension, we should officiall support mariadb features in 3.0.

ghost avatar Oct 09 '18 17:10 ghost

github.com/sam-it/yii2-mariadb.

SamMousa avatar Oct 27 '18 13:10 SamMousa

done.

terabytesoftw avatar Feb 05 '23 14:02 terabytesoftw