[GH-ISSUE #163] MySQL column definitions are incorrect #120

Closed
opened 2026-02-25 23:33:29 +03:00 by kerem · 5 comments
Owner

Originally created by @deanishe on GitHub (Sep 22, 2019).
Original GitHub issue: https://github.com/go-shiori/shiori/issues/163

  • AUTO_INCREMENT is missing on id fields
  • TEXT fields must be truncated for use in an index
  • TEXT/BLOB default values must be expressions
Originally created by @deanishe on GitHub (Sep 22, 2019). Original GitHub issue: https://github.com/go-shiori/shiori/issues/163 - `AUTO_INCREMENT` is missing on `id` fields - `TEXT` fields must be truncated for use in an index - `TEXT`/`BLOB` default values must be expressions
kerem closed this issue 2026-02-25 23:33:29 +03:00
Author
Owner

@RadhiFadlillah commented on GitHub (Sep 22, 2019):

Hi @deanishe, thanks for the PR.

  • I didn't make id field auto incremented because the ID will always be generated manually beforehand. However I guess it's fine to add it.

  • I didn't know TEXT fields must have specific length when indexed, so thanks for this. For future visitor, this can be found in MySQL documentation :

    For indexes on BLOB and TEXT columns, you must specify an index prefix length.
    

    And in MariaDB documentation :

    TEXT columns can only be indexed over a specified length. 
    
  • Could you give me the documentation about TEXT default values must be expressions ? In MySQL it simply said :

    BLOB and TEXT columns cannot have DEFAULT values.
    

    While in MariaDB it said :

    Before MariaDB 10.2.1, BLOB and TEXT columns could not be assigned a DEFAULT value. 
    This restriction was lifted in MariaDB 10.2.1.
    
<!-- gh-comment-id:533928342 --> @RadhiFadlillah commented on GitHub (Sep 22, 2019): Hi @deanishe, thanks for the PR. - I didn't make `id` field auto incremented because the ID will always be generated manually beforehand. However I guess it's fine to add it. - I didn't know `TEXT` fields must have specific length when indexed, so thanks for this. For future visitor, this can be found in [MySQL](https://dev.mysql.com/doc/refman/5.7/en/blob.html) documentation : ``` For indexes on BLOB and TEXT columns, you must specify an index prefix length. ``` And in [MariaDB](https://mariadb.com/kb/en/library/text/) documentation : ``` TEXT columns can only be indexed over a specified length. ``` - Could you give me the documentation about `TEXT` default values must be expressions ? In MySQL it simply said : ``` BLOB and TEXT columns cannot have DEFAULT values. ``` While in MariaDB it said : ``` Before MariaDB 10.2.1, BLOB and TEXT columns could not be assigned a DEFAULT value. This restriction was lifted in MariaDB 10.2.1. ```
Author
Owner

@deanishe commented on GitHub (Sep 23, 2019):

I didn't make id field auto incremented because the ID will always be generated manually beforehand

It threw an error when I tried to add a user. I figured AUTO_INCREMENT was the easiest way to solve that.

Could you give me the documentation about TEXT default values must be expressions ?

https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html#data-types-defaults-explicit

<!-- gh-comment-id:533953208 --> @deanishe commented on GitHub (Sep 23, 2019): > I didn't make id field auto incremented because the ID will always be generated manually beforehand It threw an error when I tried to add a user. I figured `AUTO_INCREMENT` was the easiest way to solve that. > Could you give me the documentation about TEXT default values must be expressions ? https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html#data-types-defaults-explicit
Author
Owner

@RadhiFadlillah commented on GitHub (Sep 23, 2019):

Thanks, now the PR has been merged.

It threw an error when I tried to add a user. I figured AUTO_INCREMENT was the easiest way to solve that.

Oh boy, I really need to make unit tests ASAP.

<!-- gh-comment-id:533966379 --> @RadhiFadlillah commented on GitHub (Sep 23, 2019): Thanks, now the PR has been merged. > It threw an error when I tried to add a user. I figured `AUTO_INCREMENT` was the easiest way to solve that. Oh boy, I really need to make unit tests ASAP.
Author
Owner

@querwurzel commented on GitHub (Nov 9, 2020):

Still doesn't work for me for MySQL 5.7 .. as you already stated BLOB and TEXT must not have default values.

@deanishe I may create a PR for that matter. Still wondering if I'm the only MySQL user here ..

<!-- gh-comment-id:723803498 --> @querwurzel commented on GitHub (Nov 9, 2020): Still doesn't work for me for MySQL 5.7 .. as you already stated BLOB and TEXT must not have default values. @deanishe I may create a PR for that matter. Still wondering if I'm the only MySQL user here ..
Author
Owner

@MaaxGr commented on GitHub (Oct 22, 2021):

This error appears for shiori-Commands:

Failed to open database: Error 1101: BLOB, TEXT, GEOMETRY or JSON column 'excerpt' can't have a default value

MySQL Version: 8.0.22

<!-- gh-comment-id:949288864 --> @MaaxGr commented on GitHub (Oct 22, 2021): This error appears for shiori-Commands: ``` Failed to open database: Error 1101: BLOB, TEXT, GEOMETRY or JSON column 'excerpt' can't have a default value ``` MySQL Version: 8.0.22
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shiori#120
No description provided.