fix: data too large for mysql (#2470)

* Extend some TEXT field to LONGTEXT in mysql

* move db migration version

* fix error in migrate SQL
This commit is contained in:
Athurg Gooth 2023-10-31 10:23:15 +08:00 committed by GitHub
parent 97190645cc
commit b966c16dd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View File

@ -22,7 +22,7 @@ CREATE TABLE `migration_history` (
-- system_setting
CREATE TABLE `system_setting` (
`name` VARCHAR(255) NOT NULL PRIMARY KEY,
`value` TEXT NOT NULL,
`value` LONGTEXT NOT NULL,
`description` TEXT NOT NULL
);
@ -37,14 +37,14 @@ CREATE TABLE `user` (
`email` VARCHAR(255) NOT NULL DEFAULT '',
`nickname` VARCHAR(255) NOT NULL DEFAULT '',
`password_hash` VARCHAR(255) NOT NULL,
`avatar_url` TEXT NOT NULL
`avatar_url` LONGTEXT NOT NULL
);
-- user_setting
CREATE TABLE `user_setting` (
`user_id` INT NOT NULL,
`key` VARCHAR(255) NOT NULL,
`value` TEXT NOT NULL,
`value` LONGTEXT NOT NULL,
UNIQUE(`user_id`,`key`)
);

View File

@ -0,0 +1,3 @@
ALTER TABLE `system_setting` MODIFY `value` LONGTEXT NOT NULL;
ALTER TABLE `user_setting` MODIFY `value` LONGTEXT NOT NULL;
ALTER TABLE `user` MODIFY `avatar_url` LONGTEXT NOT NULL;

View File

@ -22,7 +22,7 @@ CREATE TABLE `migration_history` (
-- system_setting
CREATE TABLE `system_setting` (
`name` VARCHAR(255) NOT NULL PRIMARY KEY,
`value` TEXT NOT NULL,
`value` LONGTEXT NOT NULL,
`description` TEXT NOT NULL
);
@ -37,14 +37,14 @@ CREATE TABLE `user` (
`email` VARCHAR(255) NOT NULL DEFAULT '',
`nickname` VARCHAR(255) NOT NULL DEFAULT '',
`password_hash` VARCHAR(255) NOT NULL,
`avatar_url` TEXT NOT NULL
`avatar_url` LONGTEXT NOT NULL
);
-- user_setting
CREATE TABLE `user_setting` (
`user_id` INT NOT NULL,
`key` VARCHAR(255) NOT NULL,
`value` TEXT NOT NULL,
`value` LONGTEXT NOT NULL,
UNIQUE(`user_id`,`key`)
);