Description
Feature Request
Q | A |
---|---|
New Feature | yes? |
RFC | yes |
BC Break | no |
TL;DR
I want to extend the MariaDb1027Platform
class, but can't because it is marked final
. If I choose to extend MySqlPlatform
, MySqlSchemaManager
won't recognize my platform and won't pass the column defaults to the getMariaDb1027ColumnDefault
method, causing doctrine:schema:update
to output a bunch of unnessary changes.
So I would like to request to have MariaDb1027Platform
extensible.
Summary
MariaDB introduced system-versioned tables since 10.3.4. When adding such feature to a table using the default setup (ALTER TABLE t ADD SYSTEM VERSIONING;
) MariaDB adds two invisible columns (row_start
, row_end
), and row_end
will be added to the original primary key column to form a composite key.
If these invisible columns are indeed invisible to clients in every aspects then the change sould be transparent. The tricky part here is that the columns aren't shown in SHOW COLUMNS FROM t
and alike, but are listed in SHOW INDEX FROM
and alikes. This affects phpMyAdmin. Doctrine is also affected - the doctrine:schema:update
command (in Symfony) would crash when processing index differences due to an unknown column.
MariaDB [db]> SHOW COLUMNS FROM t;
+------------+--------------+------+-----+------+---------+-------+----------------+--------------+--------------------+
| Field | Type | Null | Key | x | Default | Extra | Comment | CharacterSet | Collation |
+------------+--------------+------+-----+------+---------+-------+----------------+--------------+--------------------+
| id | char(36) | NO | PRI | NULL | NULL | | (DC2Type:uuid) | utf8mb4 | utf8mb4_unicode_ci |
| content | longtext | NO | | NULL | NULL | | (DC2Type:json) | utf8mb4 | utf8mb4_unicode_ci |
+------------+--------------+------+-----+------+---------+-------+----------------+--------------+--------------------+
MariaDB [db]> SHOW INDEX FROM t;
+--------+------------+----------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+--------+------------+----------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| t | 0 | PRIMARY | 1 | id | A | 5 | NULL | NULL | | BTREE | | |
| t | 0 | PRIMARY | 2 | row_end | A | 5 | NULL | NULL | | BTREE | | |
+--------+------------+----------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
So I am writing my own platform class to work around the hidden column issue by overriding the getListTableIndexesSQL
method. This is a somewhat hacky fix, as it doesn't handle all possible cases. Then I face the following difficuties:
- I couldn't extend my class from
MariaDb1027Platform
because it is marked final. - So I wrote my class extending from
MySqlPlatform
. Nowdoctrine:schema:update
prints a bunch of unnecessary changes, even when my code is exactly the same asMariaDb1027Platform
. - Digging deeper I found that
MySqlSchemaManager
is doing some special handling when the platform isMariaDb1027Platform
.
That's why I would like to know if it's fine to change the MariaDb1027Platform
class to be non-final. In fact this is the only platform class that is marked final in the repo.