MCPcopy Create free account
hub / github.com/firebase/firebase-tools / displaySchemaChanges

Function displaySchemaChanges

src/dataconnect/schemaMigration.ts:785–843  ·  view source on GitHub ↗
(
  error: IncompatibleSqlSchemaError,
  validationMode: SchemaValidation | "STRICT_AFTER_COMPATIBLE",
)

Source from the content-addressed store, hash-verified

783}
784
785function 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.
797Those 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.
807Those 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.
817Those 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.
831Here 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 }

Callers 2

diffSchemaFunction · 0.85
promptForSchemaMigrationFunction · 0.85

Calls 3

logLabeledWarningFunction · 0.90
logLabeledBulletFunction · 0.90
diffsToStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…