(schema: string | undefined, wildcardSchemaTables: string[])
| 667 | } |
| 668 | |
| 669 | prune(schema: string | undefined, wildcardSchemaTables: string[]): void { |
| 670 | const hasWildcardSchema = wildcardSchemaTables.length > 0; |
| 671 | this.#tables = this.#tables.filter(table => { |
| 672 | return ( |
| 673 | (!schema && !hasWildcardSchema) || // no schema specified and we don't have any multi-schema entity |
| 674 | table.schema === schema || // specified schema matches the table's one |
| 675 | (!schema && !wildcardSchemaTables.includes(table.name)) |
| 676 | ); // no schema specified and the table has fixed one provided |
| 677 | }); |
| 678 | |
| 679 | this.#views = this.#views.filter(view => { |
| 680 | /* v8 ignore next */ |
| 681 | return ( |
| 682 | (!schema && !hasWildcardSchema) || |
| 683 | view.schema === schema || |
| 684 | (!schema && !wildcardSchemaTables.includes(view.name)) |
| 685 | ); |
| 686 | }); |
| 687 | |
| 688 | // remove namespaces of ignored tables and views |
| 689 | for (const ns of this.#namespaces) { |
| 690 | if ( |
| 691 | !this.#tables.some(t => t.schema === ns) && |
| 692 | !this.#views.some(v => v.schema === ns) && |
| 693 | !Object.values(this.#nativeEnums).some(e => e.schema === ns) |
| 694 | ) { |
| 695 | this.#namespaces.delete(ns); |
| 696 | } |
| 697 | } |
| 698 | } |
| 699 | } |
no test coverage detected