fix(db): TypeORM 压缩配置对齐 SQL DDL,新增 TimescaleDB 初始化脚本
- kline.entity.ts: compress_segmentby 移除 interval(基表固定 1m 无需分段),schedule_interval 365d→30d 与 init-db SQL 一致 - data-source.ts: 生产环境关闭 synchronize,以 init-db SQL 脚本为建表唯一来源 - 新增 data/db/init-db/ 初始化 SQL 链: 01-timescaledb.sql — 启用 TimescaleDB 扩展 02-init-tables.sql — 核心业务表 + klines hypertable(7d chunk / 30d 压缩) 03-continuous-aggregates.sql — 分层连续聚合视图(5m→15m→30m→1h→4h→1d→1w)
This commit is contained in:
@@ -15,7 +15,7 @@ export const AppDataSource = new DataSource({
|
||||
...Object.values(entities),
|
||||
],
|
||||
// 生产环境禁用 synchronize,使用 Migration
|
||||
synchronize: true,
|
||||
synchronize: false,
|
||||
migrations: [__dirname + "/migrations/*.{ts,js}"],
|
||||
// 连接池
|
||||
extra: {
|
||||
|
||||
Reference in New Issue
Block a user