Record Class SchemaSnapshot

java.lang.Object
java.lang.Record
com.onec.schema.SchemaSnapshot

public record SchemaSnapshot(Map<String,SchemaSnapshot.TableSnapshot> tables) extends Record
A point-in-time record of the metadata-derived schema, persisted as JSON in onec_schema_history. The diff engine compares the previous snapshot's declared column types against the current metadata to detect type changes (something a live-DB existence check cannot see), and uses the snapshot's table list to recognize tables that used to be metadata-managed and have since been removed from the model.
  • Constructor Details

    • SchemaSnapshot

      public SchemaSnapshot(Map<String,SchemaSnapshot.TableSnapshot> tables)
      Creates an instance of a SchemaSnapshot record class.
      Parameters:
      tables - the value for the tables record component
  • Method Details

    • table

      public SchemaSnapshot.TableSnapshot table(String name)
    • of

      public static SchemaSnapshot of(SchemaModel model)
    • toJson

      public String toJson()
    • fromJson

      public static SchemaSnapshot fromJson(String json)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • tables

      Returns the value of the tables record component.
      Returns:
      the value of the tables record component