( json1: PgSchemaSquashed, json2: PgSchemaSquashed, schemasResolver: ( input: ResolverInput<Named>, ) => Promise<ResolverOutput<Named>>, enumsResolver: ( input: ResolverInput<Enum>, ) => Promise<ResolverOutputWithMoved<Enum>>, sequencesResolver: ( input: ResolverInput<Sequence>, ) => Promise<ResolverOutputWithMoved<Sequence>>, policyResolver: ( input: TablePolicyResolverInput<Policy>, ) => Promise<TablePolicyResolverOutput<Policy>>, indPolicyResolver: ( input: PolicyResolverInput<Policy>, ) => Promise<PolicyResolverOutput<Policy>>, roleResolver: ( input: RolesResolverInput<Role>, ) => Promise<RolesResolverOutput<Role>>, tablesResolver: ( input: ResolverInput<Table>, ) => Promise<ResolverOutputWithMoved<Table>>, columnsResolver: ( input: ColumnsResolverInput<Column>, ) => Promise<ColumnsResolverOutput<Column>>, viewsResolver: ( input: ResolverInput<View>, ) => Promise<ResolverOutputWithMoved<View>>, prevFull: PgSchema, curFull: PgSchema, action?: 'push' | undefined, )
| 557 | // tests everything! |
| 558 | |
| 559 | export const applyPgSnapshotsDiff = async ( |
| 560 | json1: PgSchemaSquashed, |
| 561 | json2: PgSchemaSquashed, |
| 562 | schemasResolver: ( |
| 563 | input: ResolverInput<Named>, |
| 564 | ) => Promise<ResolverOutput<Named>>, |
| 565 | enumsResolver: ( |
| 566 | input: ResolverInput<Enum>, |
| 567 | ) => Promise<ResolverOutputWithMoved<Enum>>, |
| 568 | sequencesResolver: ( |
| 569 | input: ResolverInput<Sequence>, |
| 570 | ) => Promise<ResolverOutputWithMoved<Sequence>>, |
| 571 | policyResolver: ( |
| 572 | input: TablePolicyResolverInput<Policy>, |
| 573 | ) => Promise<TablePolicyResolverOutput<Policy>>, |
| 574 | indPolicyResolver: ( |
| 575 | input: PolicyResolverInput<Policy>, |
| 576 | ) => Promise<PolicyResolverOutput<Policy>>, |
| 577 | roleResolver: ( |
| 578 | input: RolesResolverInput<Role>, |
| 579 | ) => Promise<RolesResolverOutput<Role>>, |
| 580 | tablesResolver: ( |
| 581 | input: ResolverInput<Table>, |
| 582 | ) => Promise<ResolverOutputWithMoved<Table>>, |
| 583 | columnsResolver: ( |
| 584 | input: ColumnsResolverInput<Column>, |
| 585 | ) => Promise<ColumnsResolverOutput<Column>>, |
| 586 | viewsResolver: ( |
| 587 | input: ResolverInput<View>, |
| 588 | ) => Promise<ResolverOutputWithMoved<View>>, |
| 589 | prevFull: PgSchema, |
| 590 | curFull: PgSchema, |
| 591 | action?: 'push' | undefined, |
| 592 | ): Promise<{ |
| 593 | statements: JsonStatement[]; |
| 594 | sqlStatements: string[]; |
| 595 | _meta: |
| 596 | | { |
| 597 | schemas: {}; |
| 598 | tables: {}; |
| 599 | columns: {}; |
| 600 | } |
| 601 | | undefined; |
| 602 | }> => { |
| 603 | const schemasDiff = diffSchemasOrTables(json1.schemas, json2.schemas); |
| 604 | |
| 605 | const { |
| 606 | created: createdSchemas, |
| 607 | deleted: deletedSchemas, |
| 608 | renamed: renamedSchemas, |
| 609 | } = await schemasResolver({ |
| 610 | created: schemasDiff.added.map((it) => ({ name: it })), |
| 611 | deleted: schemasDiff.deleted.map((it) => ({ name: it })), |
| 612 | }); |
| 613 | |
| 614 | const schemasPatchedSnap1 = copy(json1); |
| 615 | schemasPatchedSnap1.tables = mapEntries( |
| 616 | schemasPatchedSnap1.tables, |
no test coverage detected