Skip to content

Commit

Permalink
fix: modify name column charset to make it case-sensitive for MySQL (#…
Browse files Browse the repository at this point in the history
…6897)

#### What type of PR is this?
/kind improvement
/area core
/milestone 2.20.x

#### What this PR does / why we need it:
将 MySQL 的表创建脚本 name 列字符集改为 utf8mb4_bin 以使其对大小写敏感

Fixes #4372

**how to test it?**
使用 docker 运行 MySQL
```shell
# mariadb 同样将镜像改为 mariadb 后执行相同步骤
docker run --name mysql-test -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=halo -p 3306:3306 --rm -d mysql:latest
```
然后执行表创建脚本并手动执行以下两条 SQL 能成功插入
```sql
insert into extensions(name,data,version) values('a', 'a', 0)
insert into extensions(name,data,version) values('A', 'A', 0)
```

#### Does this PR introduce a user-facing change?
```release-note
修改 MySQL 表创建脚本 name 列的字符集使其大小写敏感以解决可能会遇到切换数据库时因为数据冲突而无法导入备份的问题(这只对此版本及之后的新用户有效)
```
  • Loading branch information
guqing authored Oct 18, 2024
1 parent 13644d2 commit 833b884
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion application/src/main/resources/schema-mariadb.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
create table if not exists extensions
(
name varchar(255) not null,
name varchar(255) not null COLLATE utf8mb4_bin,
data longblob,
version bigint,
primary key (name)
Expand Down
2 changes: 1 addition & 1 deletion application/src/main/resources/schema-mysql.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
create table if not exists extensions
(
name varchar(255) not null,
name varchar(255) not null COLLATE utf8mb4_bin,
data longblob,
version bigint,
primary key (name)
Expand Down

0 comments on commit 833b884

Please sign in to comment.