init: 从 /root/zikai 根目录迁入

把原本散落在 /root/zikai 的 FastAPI 服务整理到 server/ 子目录,
开启独立 git 与 venv。运行时数据(config.yaml / keys / uploads)
按 .gitignore 留在工作目录但不入仓。
This commit is contained in:
zikai
2026-06-23 16:17:31 +00:00
commit 80b96d236f
31 changed files with 1491 additions and 0 deletions

20
sql/schema.sql Normal file
View File

@@ -0,0 +1,20 @@
-- zikai_filesvc 数据库的表定义。
-- 由 app/scripts/init_db.py 通过本机 socket 以 root 身份执行;表级幂等。
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `uploaded_file` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`storage_path` VARCHAR(512) NOT NULL COMMENT 'upload_dir 下相对路径,例如 2026/06/<uuid>.bin',
`original_filename` VARCHAR(512) NOT NULL,
`content_type` VARCHAR(255) NOT NULL DEFAULT '',
`size_bytes` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`sha256` CHAR(64) NOT NULL DEFAULT '',
`source` VARCHAR(32) NOT NULL DEFAULT 'http' COMMENT 'http / sftp / ...',
`uploaded_by` VARCHAR(128) NOT NULL DEFAULT '',
`uploaded_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_uploaded_at` (`uploaded_at`),
KEY `idx_source` (`source`),
KEY `idx_sha256` (`sha256`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;