feat(database): 添加 MySQL 数据库支持并迁移数据表结构

- 新增 MySQL 5.7.44 建表脚本,包含分组、图片、Markdown文件等7张表
- 添加 SQLite 转 MySQL 的数据库迁移脚本
- 配置开发环境使用 MySQL 数据源连接
- 更新生产环境配置注释 SQLite 配置并预留 MySQL 配置位置
- 修改前端笔记编辑器保存逻辑,完善笔记更新功能
- 替换 SQLite 驱动为 MySQL 连接器依赖
- 添加 commons-codec 依赖用于 SHA256 计算功能
This commit is contained in:
ikmkj
2026-01-06 21:18:06 +08:00
parent 2c1abafee7
commit a0991db83e
7 changed files with 328 additions and 21 deletions

View File

@@ -71,11 +71,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- sqlite -->
<!-- MySQL Driver -->
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.36.0.3</version>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
@@ -110,6 +110,7 @@
<!-- 密码加密-->
<!-- SHA256计算工具 -->
<dependency>
<groupId>commons-codec</groupId>

View File

@@ -1,18 +1,31 @@
spring:
datasource:
driver-class-name: org.sqlite.JDBC
url: jdbc:sqlite:C:\it\houtaigunli\biji\mydatabase.db
# driver-class-name: org.sqlite.JDBC
# url: jdbc:sqlite:C:\it\houtaigunli\biji\mydatabase.db
# jpa:
# hibernate:
# ddl-auto: none
# show-sql: true
# properties:
# hibernate:
# format_sql: true
# dialect: org.hibernate.dialect.SQLiteDialect
#
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://panel-jp.998521.xyz:37857/biji_db?useSSL=false&serverTimezone=UTC&characterEncoding=utf8
username: root
password: Ll@12331100
jpa:
hibernate:
ddl-auto: none
ddl-auto: update
show-sql: true
properties:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.SQLiteDialect
dialect: org.hibernate.dialect.MySQLDialect
# MyBatis-Plus??
# MyBatis-Plus配置
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
configuration:

View File

@@ -1,15 +1,17 @@
spring:
datasource:
driver-class-name: org.sqlite.JDBC
url: jdbc:sqlite:/data/mydatabase.db
jpa:
hibernate:
ddl-auto: none
show-sql: false
properties:
hibernate:
format_sql: false
dialect: org.hibernate.dialect.SQLiteDialect
# datasource:
# driver-class-name: org.sqlite.JDBC
# url: jdbc:sqlite:/data/mydatabase.db
# jpa:
# hibernate:
# ddl-auto: none
# show-sql: false
# properties:
# hibernate:
# format_sql: false
# dialect: org.hibernate.dialect.SQLiteDialect