datasquirel/package-shared/utils/grab-app-main-db-schema.ts
Benjamin Toby 7e8bb37c09 Updates
2025-07-05 14:59:30 +01:00

19 lines
509 B
TypeScript

import fs from "fs";
import grabDirNames from "./backend/names/grab-dir-names";
import EJSON from "./ejson";
import { DSQL_DatabaseSchemaType } from "../types";
export default function grabAppMainDbSchema() {
const { appSchemaJSONFile } = grabDirNames();
if (!fs.existsSync(appSchemaJSONFile)) {
return undefined;
}
const parsedAppSchema = EJSON.parse(
fs.readFileSync(appSchemaJSONFile, "utf-8")
) as DSQL_DatabaseSchemaType | undefined;
return parsedAppSchema;
}