12 lines
453 B
JavaScript
12 lines
453 B
JavaScript
export default function grabTargetTableSchemaIndex({ tables, tableName, tableSchema, childTableSchema, }) {
|
|
if (!tables)
|
|
return undefined;
|
|
const targetTableIndex = tables.findIndex((tbl) => (tableName && tableName == tbl.tableName) ||
|
|
(tableSchema &&
|
|
tableSchema.tableName &&
|
|
tableSchema.tableName == tbl.tableName));
|
|
if (targetTableIndex < 0)
|
|
return undefined;
|
|
return targetTableIndex;
|
|
}
|