[GH-ISSUE #1009] Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1101 (42000): BLOB, TEXT, GEOMETRY or JSON column 'config' can't have a default v… #440

Closed
opened 2026-02-25 23:34:14 +03:00 by kerem · 13 comments
Owner

Originally created by @huyangkkk on GitHub (Nov 11, 2024).
Original GitHub issue: https://github.com/go-shiori/shiori/issues/1009

Data

Shiori version 1.7.1 (build 2315f0da40)

Describe the bug / actual behavior

databases: mysql
version:8.0.36
os:ubuntu

time="2024-11-11T17:31:03+08:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1101 (42000): BLOB, TEXT, GEOMETRY or JSON column 'config' can't have a default value"

Expected behavior

start Shiori

Originally created by @huyangkkk on GitHub (Nov 11, 2024). Original GitHub issue: https://github.com/go-shiori/shiori/issues/1009 ## Data Shiori version 1.7.1 (build 2315f0da403a2e5dca6841e83f0fac5f52e4a18f) ## Describe the bug / actual behavior databases: mysql version:8.0.36 os:ubuntu ``` time="2024-11-11T17:31:03+08:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1101 (42000): BLOB, TEXT, GEOMETRY or JSON column 'config' can't have a default value" ``` ## Expected behavior start Shiori
kerem 2026-02-25 23:34:14 +03:00
Author
Owner

@fmartingr commented on GitHub (Nov 17, 2024):

Which version of the mysql/mariadb server are you using?

<!-- gh-comment-id:2480927656 --> @fmartingr commented on GitHub (Nov 17, 2024): Which version of the mysql/mariadb server are you using?
Author
Owner

@huyangkkk commented on GitHub (Nov 18, 2024):

mysql version:8.0.36

<!-- gh-comment-id:2481906180 --> @huyangkkk commented on GitHub (Nov 18, 2024): mysql version:8.0.36
Author
Owner

@sandeepkumar1101 commented on GitHub (Dec 23, 2024):

Any update i am also facing same issue

mysql version:8.0.36

<!-- gh-comment-id:2558905318 --> @sandeepkumar1101 commented on GitHub (Dec 23, 2024): Any update i am also facing same issue `mysql version:8.0.36`
Author
Owner

@Varamil commented on GitHub (Jan 1, 2025):

Same kind of error on my side, with slightly different error message:
time="2025-01-01T14:53:42+01:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL DEFAULT '{}',\n\t\tPRIMARY KEY (id),\n\t\tUNIQUE KEY account_u' at line 6"

Shiori 1.7.2 on windows 11.
mysql 8.0.30

<!-- gh-comment-id:2567022431 --> @Varamil commented on GitHub (Jan 1, 2025): Same kind of error on my side, with slightly different error message: `time="2025-01-01T14:53:42+01:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL DEFAULT '{}',\n\t\tPRIMARY KEY (id),\n\t\tUNIQUE KEY account_u' at line 6"` Shiori 1.7.2 on windows 11. mysql 8.0.30
Author
Owner

@fmartingr commented on GitHub (Jan 1, 2025):

Found the issue causing this, will be fixed in 1.7.3 which I plan to release today.

<!-- gh-comment-id:2567041098 --> @fmartingr commented on GitHub (Jan 1, 2025): Found the issue causing this, will be fixed in 1.7.3 which I plan to release today.
Author
Owner

@Varamil commented on GitHub (Jan 2, 2025):

Still same issue with 1.7.3. Information I haven't mention is the database is empty when shiori is started and the error raise.

<!-- gh-comment-id:2567605583 --> @Varamil commented on GitHub (Jan 2, 2025): Still same issue with 1.7.3. Information I haven't mention is the database is empty when shiori is started and the error raise.
Author
Owner

@fmartingr commented on GitHub (Jan 2, 2025):

I've run the test suite locally using MySQL 8.0.40 which executes the entire migration set per test and didn't get any errors. That was the way I reproduced it originally, and now it should work for MySQL 8.0.13+.

Are you getting the same error or a new one?

<!-- gh-comment-id:2568230282 --> @fmartingr commented on GitHub (Jan 2, 2025): I've run the test suite locally using MySQL 8.0.40 which executes the entire migration set per test and didn't get any errors. That was the way I reproduced it originally, and now it should work for MySQL 8.0.13+. Are you getting the same error or a new one?
Author
Owner

@Varamil commented on GitHub (Jan 3, 2025):

Yes exactly the same error:
time="2025-01-03T09:22:54+01:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL DEFAULT ('{}'),\n\t\tPRIMARY KEY (id),\n\t\tUNIQUE KEY account' at line 6"

Shiori 1.7.3 on windows 11.
mysql 8.0.30, database empty when running shiori
Command used: .\shiori.exe server --secret-key "SecretKey" -p 8081
SHIORI_DATABASE_URL="mysql://user:pass@tcp(address)/databaseName?charset=utf8mb4"

<!-- gh-comment-id:2568849346 --> @Varamil commented on GitHub (Jan 3, 2025): Yes exactly the same error: `time="2025-01-03T09:22:54+01:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL DEFAULT ('{}'),\n\t\tPRIMARY KEY (id),\n\t\tUNIQUE KEY account' at line 6"` Shiori 1.7.3 on windows 11. mysql 8.0.30, database empty when running shiori Command used: `.\shiori.exe server --secret-key "SecretKey" -p 8081` `SHIORI_DATABASE_URL="mysql://user:pass@tcp(address)/databaseName?charset=utf8mb4"`
Author
Owner

@fmartingr commented on GitHub (Jan 3, 2025):

Yes exactly the same error: time="2025-01-03T09:22:54+01:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL DEFAULT ('{}'),\n\t\tPRIMARY KEY (id),\n\t\tUNIQUE KEY account' at line 6"

Shiori 1.7.3 on windows 11. mysql 8.0.30, database empty when running shiori Command used: .\shiori.exe server --secret-key "SecretKey" -p 8081 SHIORI_DATABASE_URL="mysql://user:pass@tcp(address)/databaseName?charset=utf8mb4"

Are you sure you are running MySQL 8.0.30? Your error log says "MariaDB".

<!-- gh-comment-id:2568930695 --> @fmartingr commented on GitHub (Jan 3, 2025): > Yes exactly the same error: `time="2025-01-03T09:22:54+01:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL DEFAULT ('{}'),\n\t\tPRIMARY KEY (id),\n\t\tUNIQUE KEY account' at line 6"` > > Shiori 1.7.3 on windows 11. mysql 8.0.30, database empty when running shiori Command used: `.\shiori.exe server --secret-key "SecretKey" -p 8081` `SHIORI_DATABASE_URL="mysql://user:pass@tcp(address)/databaseName?charset=utf8mb4"` Are you sure you are running MySQL 8.0.30? Your error log says "MariaDB".
Author
Owner

@Varamil commented on GitHub (Jan 5, 2025):

Hum, you're right. The documentation of my host was unclear, sorry. However, I was able to switch to a MySQL database, but it was only on version 5.5.40, which looks quite old. I don't know what is the minimum version required for Shiori ?

By the way, I've tried to run Shiori, just to see, and I get the same error:
time="2025-01-05T07:47:22+01:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JSON NOT NULL DEFAULT ('{}'),\n\t\tPRIMARY KEY (id),\n\t\tUNIQUE KEY account' at line 6"
except MariaDB is replaced by MySQL.

<!-- gh-comment-id:2571525742 --> @Varamil commented on GitHub (Jan 5, 2025): Hum, you're right. The documentation of my host was unclear, sorry. However, I was able to switch to a MySQL database, but it was only on version 5.5.40, which looks quite old. I don't know what is the minimum version required for Shiori ? By the way, I've tried to run Shiori, just to see, and I get the same error: `time="2025-01-05T07:47:22+01:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JSON NOT NULL DEFAULT ('{}'),\n\t\tPRIMARY KEY (id),\n\t\tUNIQUE KEY account' at line 6"` except MariaDB is replaced by MySQL.
Author
Owner

@fmartingr commented on GitHub (Jan 5, 2025):

Hum, you're right. The documentation of my host was unclear, sorry. However, I was able to switch to a MySQL database, but it was only on version 5.5.40, which looks quite old. I don't know what is the minimum version required for Shiori ?

By the way, I've tried to run Shiori, just to see, and I get the same error: time="2025-01-05T07:47:22+01:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JSON NOT NULL DEFAULT ('{}'),\n\t\tPRIMARY KEY (id),\n\t\tUNIQUE KEY account' at line 6" except MariaDB is replaced by MySQL.

Yeah, for MySQL you need to run 8.0.13+. Unsure about the parity with MariaDB, but I just ran the test suite with 10.5.27 (the oldest supported release) and it completed successfully.

<!-- gh-comment-id:2571531260 --> @fmartingr commented on GitHub (Jan 5, 2025): > Hum, you're right. The documentation of my host was unclear, sorry. However, I was able to switch to a MySQL database, but it was only on version 5.5.40, which looks quite old. I don't know what is the minimum version required for Shiori ? > > By the way, I've tried to run Shiori, just to see, and I get the same error: `time="2025-01-05T07:47:22+01:00" level=fatal msg="Error running migration" error="failed to run migration from 0.2.0 to 0.3.0: failed to run transaction: failed to execute migration 0.2.0 to 0.3.0: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JSON NOT NULL DEFAULT ('{}'),\n\t\tPRIMARY KEY (id),\n\t\tUNIQUE KEY account' at line 6"` except MariaDB is replaced by MySQL. Yeah, for MySQL you need to run 8.0.13+. Unsure about the parity with MariaDB, but I just ran the test suite with 10.5.27 (the oldest supported release) and it completed successfully.
Author
Owner

@Varamil commented on GitHub (Jan 5, 2025):

OK thanks, sorry again for the trouble.

<!-- gh-comment-id:2571534764 --> @Varamil commented on GitHub (Jan 5, 2025): OK thanks, sorry again for the trouble.
Author
Owner

@fmartingr commented on GitHub (Jan 5, 2025):

Don't worry, I'm going to update the CI to fire up every database engine on the oldest supported release so we catch this things beforehand. 👍

<!-- gh-comment-id:2571537044 --> @fmartingr commented on GitHub (Jan 5, 2025): Don't worry, I'm going to update the CI to fire up every database engine on the oldest supported release so we catch this things beforehand. 👍
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#440
No description provided.