MCPcopy Index your code
hub / github.com/subquery/subql / getExistingProjectSchema

Function getExistingProjectSchema

packages/node-core/src/utils/project.ts:58–77  ·  view source on GitHub ↗
(
  nodeConfig: NodeConfig,
  sequelize: Sequelize
)

Source from the content-addressed store, hash-verified

56}
57
58export async function getExistingProjectSchema(
59 nodeConfig: NodeConfig,
60 sequelize: Sequelize
61): Promise<string | undefined> {
62 const schema = nodeConfig.dbSchema;
63
64 let schemas: string[];
65 try {
66 const result = await sequelize.query(`SELECT schema_name FROM information_schema.schemata`, {
67 type: QueryTypes.SELECT,
68 });
69 schemas = result.map((x: any) => x.schema_name);
70 } catch (err) {
71 exitWithError(new Error(`Unable to fetch all schemas`, {cause: err}), logger);
72 }
73 if (!schemas.includes(schema)) {
74 return undefined;
75 }
76 return schema;
77}
78
79export async function getEnumDeprecated(sequelize: Sequelize, enumTypeNameDeprecated: string): Promise<unknown[]> {
80 const [resultsDeprecated] = await sequelize.query(

Callers 3

forceCleanMethod · 0.90

Calls 2

exitWithErrorFunction · 0.90
mapMethod · 0.80

Tested by

no test coverage detected