19 lines
509 B
TypeScript
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;
|
|
}
|