2d847e154f
中华文明全图鉴——文物全图系统(PC Web 地图 + NestJS API + 管理后台)。 含三大 IP(文物南迁北归 / 国宝海外回归 / 博物馆手艺人)、AI 文物对话、 文物地图与详情、以及 demo-video-kit 演示视频生成工具。
24 lines
602 B
TypeScript
24 lines
602 B
TypeScript
import * as fs from "fs";
|
|
import * as path from "path";
|
|
import { getPool } from "./pool";
|
|
|
|
export async function runSeeds(): Promise<void> {
|
|
const pool = getPool();
|
|
const seedsDir = path.resolve(__dirname, "../seeds");
|
|
|
|
const files = fs
|
|
.readdirSync(seedsDir)
|
|
.filter((f) => f.endsWith(".sql"))
|
|
.sort();
|
|
|
|
for (const file of files) {
|
|
const sql = fs.readFileSync(path.join(seedsDir, file), "utf-8");
|
|
console.log(`[seed] apply ${file}`);
|
|
await pool.query(sql);
|
|
console.log(`[seed] done ${file}`);
|
|
}
|
|
|
|
console.log("[seed] all seeds complete");
|
|
await pool.end();
|
|
}
|