( error: IncompatibleSqlSchemaError, validationMode: SchemaValidation | "STRICT_AFTER_COMPATIBLE", )
| 783 | } |
| 784 | |
| 785 | function displaySchemaChanges( |
| 786 | error: IncompatibleSqlSchemaError, |
| 787 | validationMode: SchemaValidation | "STRICT_AFTER_COMPATIBLE", |
| 788 | ): void { |
| 789 | switch (error.violationType) { |
| 790 | case "INCOMPATIBLE_SCHEMA": |
| 791 | { |
| 792 | switch (validationMode) { |
| 793 | case "COMPATIBLE": |
| 794 | logLabeledWarning( |
| 795 | "dataconnect", |
| 796 | `PostgreSQL schema is incompatible with the SQL Connect Schema. |
| 797 | Those SQL statements will migrate it to be compatible: |
| 798 | |
| 799 | ${diffsToString(error.diffs)} |
| 800 | `, |
| 801 | ); |
| 802 | break; |
| 803 | case "STRICT_AFTER_COMPATIBLE": |
| 804 | logLabeledBullet( |
| 805 | "dataconnect", |
| 806 | `PostgreSQL schema contains unused SQL objects not part of the SQL Connect Schema. |
| 807 | Those SQL statements will migrate it to match exactly: |
| 808 | |
| 809 | ${diffsToString(error.diffs)} |
| 810 | `, |
| 811 | ); |
| 812 | break; |
| 813 | case "STRICT": |
| 814 | logLabeledWarning( |
| 815 | "dataconnect", |
| 816 | `PostgreSQL schema does not match the SQL Connect Schema. |
| 817 | Those SQL statements will migrate it to match exactly: |
| 818 | |
| 819 | ${diffsToString(error.diffs)} |
| 820 | `, |
| 821 | ); |
| 822 | break; |
| 823 | } |
| 824 | } |
| 825 | break; |
| 826 | case "INACCESSIBLE_SCHEMA": |
| 827 | { |
| 828 | logLabeledWarning( |
| 829 | "dataconnect", |
| 830 | `Cannot access CloudSQL database to validate schema. |
| 831 | Here is the complete expected SQL schema: |
| 832 | ${diffsToString(error.diffs)} |
| 833 | `, |
| 834 | ); |
| 835 | logLabeledWarning("dataconnect", "Some SQL resources may already exist."); |
| 836 | } |
| 837 | break; |
| 838 | default: |
| 839 | throw new FirebaseError( |
| 840 | `Unknown schema violation type: ${error.violationType}, IncompatibleSqlSchemaError: ${error}`, |
| 841 | ); |
| 842 | } |
no test coverage detected
searching dependent graphs…