( nodeConfig: NodeConfig, sequelize: Sequelize )
| 56 | } |
| 57 | |
| 58 | export 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 | |
| 79 | export async function getEnumDeprecated(sequelize: Sequelize, enumTypeNameDeprecated: string): Promise<unknown[]> { |
| 80 | const [resultsDeprecated] = await sequelize.query( |
no test coverage detected