Skip to content

Commit f76fda6

Browse files
committed
feat(core): 启用数据库捆绑功能支持
- 默认启用 sqlite-bundled 功能 - 添加 mysql-bundled 和 postgres-bundled 功能选项 - 更新依赖配置以支持捆绑编译 - 调整环境变量配置文件中的数据库设置 - 增加对多种数据库后端的静态链接支持
1 parent 12bc765 commit f76fda6

File tree

6 files changed

+59
-23
lines changed

6 files changed

+59
-23
lines changed

.file_classification_env

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
#DATABASE_URL=mysql://root:mypassword@localhost:3306/file_classification
44
#DATABASE_TYPE=mysql
55

6-
DATABASE_URL=file_classification.db
7-
DATABASE_TYPE=sqlite
6+
#DATABASE_URL=file_classification.db
7+
#DATABASE_TYPE=sqlite
88

9-
#DATABASE_URL=mysql://root:@localhost:3306/file_classification
10-
#DATABASE_TYPE=mysql
9+
DATABASE_URL=mysql://root:@localhost:3306/file_classification
10+
DATABASE_TYPE=mysql
1111

1212
# Web API 配置
1313
BIND_ADDRESS=127.0.0.1

Cargo.lock

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

file_classification_cli/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ assert_cmd = "2.0.14"
2222
[target.'cfg(not(target_env = "musl"))'.dependencies]
2323

2424
[features]
25-
default = ["sqlite"]
25+
default = ["sqlite-bundled"]
2626
sqlite = ["file_classification_core/sqlite"]
2727
mysql = ["file_classification_core/mysql"]
2828
postgres = ["file_classification_core/postgres"]
29+
sqlite-bundled = ["file_classification_core/sqlite-bundled"]
30+
mysql-bundled = ["file_classification_core/mysql-bundled"]
31+
postgres-bundled = ["file_classification_core/postgres-bundled"]

file_classification_core/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ serde = { workspace = true }
1515
utoipa = { workspace = true, optional = true }
1616

1717
[features]
18-
default = ["sqlite"]
18+
default = ["sqlite-bundled"]
1919
sqlite = ["libsqlite3-sys", "diesel/sqlite", "diesel/returning_clauses_for_sqlite_3_35"]
2020
mysql = ["mysqlclient-sys", "diesel/mysql"]
2121
postgres = ["pq-sys", "openssl-sys", "diesel/postgres"]
22+
sqlite-bundled = ["sqlite", "libsqlite3-sys/bundled"]
23+
mysql-bundled = ["mysql", "mysqlclient-sys/bundled"]
24+
postgres-bundled = ["postgres", "pq-sys/bundled", "openssl-sys"]
2225
swagger = ["utoipa"]

file_classification_webapi/.file_classification_env

Lines changed: 0 additions & 16 deletions
This file was deleted.

file_classification_webapi/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ fern = "0.6"
2727
dotenvy = "0.15"
2828

2929
[features]
30-
default = ["sqlite"]
30+
default = ["sqlite-bundled"]
3131
sqlite = ["file_classification_core/sqlite", "diesel/sqlite", "diesel/returning_clauses_for_sqlite_3_35"]
3232
mysql = ["file_classification_core/mysql", "diesel/mysql"]
3333
postgres = ["file_classification_core/postgres", "diesel/postgres"]
34+
sqlite-bundled = ["file_classification_core/sqlite-bundled", "diesel/sqlite", "diesel/returning_clauses_for_sqlite_3_35"]
35+
mysql-bundled = ["file_classification_core/mysql-bundled", "diesel/mysql"]
36+
postgres-bundled = ["file_classification_core/postgres-bundled", "diesel/postgres"]
3437

3538
[[bin]]
3639
name = "file_classification_webapi"

0 commit comments

Comments
 (0)