db
db copied to clipboard
Separate MariaDB schema
@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\Schemaand related classes that extend from the MySQL version. - When creating a
JSONcolumn we must manually add theJSONvalidation 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
JSONcolumns inMariaDBvia column comments or name pattern matching. - Create option to detect
JSONcolumn by parsing constraints viaSHOW 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.
@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
@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 :)
@samdark commented on Jul 5, 2018, 5:04 PM UTC:
Not all drivers but the ones core team aren't able to maintain themselves.
@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.
@cebe commented on Jul 14, 2018, 12:00 AM UTC:
See my comment in #16515, MariaDB should be offically supported.
@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.
github.com/sam-it/yii2-mariadb.
done.