feat: 🐘 新增 PostgreSQL 数据库支持 #345
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
本次提交为应用增加了 PostgreSQL 作为新的数据库后端选项,与现有的 MySQL 和 SQLite 并行。
主要变更包括:
.env.example
和app/config/config.py
中添加了 PostgreSQL 相关的配置项和验证逻辑。app/database/connection.py
以处理 PostgreSQL 数据库连接。requirements.txt
中添加了asyncpg
和psycopg2-binary
依赖。docker-compose.yml
中添加了postgres
服务,并创建了新的docker-compose.build.yml
用于本地构建和开发。app/database/models.py
中的时间戳处理,统一使用带时区的 UTC 时间,以增强跨数据库的兼容性。app/config/config.py
中sync_initial_settings
函数在sqlite
环境下的时间戳处理问题。