SchemaComparator
Index
Constructors
constructor
Parameters
platform: AbstractSqlPlatform
Returns SchemaComparator
Methods
compare
Returns a SchemaDifference object containing the differences between the schemas fromSchema and toSchema.
The returned differences are returned in such a way that they contain the operations to change the schema stored in fromSchema to the schema that is stored in toSchema.
Parameters
fromSchema: DatabaseSchema
toSchema: DatabaseSchema
optionalinverseDiff: SchemaDifference
Returns SchemaDifference
diffCollation
fromis the introspected DB state,tois the target metadata. A column-levelCOLLATEclause naming the table/database default is just verbose syntax for inheriting that default, so both sides are normalized — anything matchingtableDefaultcollapses toundefinedand compares equal to "no explicit collation". Comparison is case-insensitive on dialects that treat collation identifiers as case-insensitive (MySQL/MSSQL/SQLite); PostgreSQL'spg_collation.collnameis case-sensitive and is compared verbatim.Parameters
optionalfromCollation: string
optionaltoCollation: string
optionaltableDefault: string
Returns boolean
diffColumn
diffComment
Parameters
optionalcomment1: string
optionalcomment2: string
Returns boolean
diffEnumItems
Parameters
items1: string[] = []
items2: string[] = []
Returns boolean
diffExpression
Parameters
expr1: string
expr2: string
Returns boolean
diffForeignKey
Parameters
key1: ForeignKey
key2: ForeignKey
tableDifferences: TableDifference
Returns boolean
diffIndex
diffTable
Returns the difference between the tables fromTable and toTable. If there are no differences this method returns the boolean false.
Parameters
fromTable: DatabaseTable
toTable: DatabaseTable
optionalinverseTableDiff: TableDifference
Returns false | TableDifference
hasSameDefaultValue
isIndexFulfilledBy
parseJsonDefault
Parameters
optionaldefaultValue: null | string
Returns null | string | Dictionary
Compares two Schemas and return an instance of SchemaDifference.