[db]: Remove not supported column comments for SQLite#36803
Conversation
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
6038e99 to
a9af58f
Compare
|
Sounds weird. Comments are supported by doctrine and sqlite: doctrine/dbal#819 |
The documentation does not list SQLite as supported: Also SQL comments are not supported by SQLite (only inline comments within the schema). How you can reproduce the error:
Or any other app you like and try to run a migration containing $table->addColumn('foo', Types::INTEGER, [
'notnull' => false,
'default' => 0,
'comment' => 'unix-timestamp',
]); |
|
Hi, I created a bug report for doctrine/dbal: doctrine/dbal#5934.
I don't like the idea of having code in Nextcloud to remove comments on SQLite. My recommendation is to remove the comments from the migrations because a comment in the code is a better place to document that a column should store a certain type of data. |
kesselb
left a comment
There was a problem hiding this comment.
Seems valid, should work, still I don't like it ;)
jotoeri
left a comment
There was a problem hiding this comment.
Looks good to me. 👍
I'd rather have the comment at least when using mysql,... (and e.g. phpmyadmin), than not having it at all. To have code-comments is independently of course a good thing.
- One could perhaps here add a comment to link to the dbal-issue. So once resolved one could re-check, if the comment-removal is still necessary.
|
/backport to stable25 |
|
/backport to stable24 |
|
Can we add a test to https://github.com/nextcloud/server/blob/master/tests/lib/DB/MigratorTest.php |
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
8c58482 to
1785a80
Compare
@nickvergessen done :) |
Summary
Some times column comments are used, e.g. to make clear an integer is used as a timestamp.
For SQLite column comments are not supported and migration that use column comments will not work (see linked comment above for an example).
Somehow it works when you have a clean install, then all migrations pass, but when executing single migrations they will fail.
This solves the problem by simply removing column comments when using SQLite.
Checklist