Differ
Diff projects or schemas and get changes between them
Method Summary
Public Methods | ||
public |
containsBreakingChanges(changes: Changes): Boolean Check if the changes contain a change that removes data. |
|
public |
diffProject(projectId: String, oldProject: Project, project: Project): Changes Get changes by comparing 2 projects |
|
public |
diffProjects(oldProjects: Projects, projects: Projects): Changes Get changes by comparing 2 sets of projects |
|
public |
Get changes by comparing 2 schemas |
Protected Methods | ||
protected |
sortChanges(changes: Changes): Changes Sort changes |
Public Methods
public containsBreakingChanges(changes: Changes): Boolean source
Check if the changes contain a change that removes data.
The following changes are breaking
- schema.remove
- column.remove
- column.typechange
Params:
Name | Type | Attribute | Description |
changes | Changes | An array of changes |
Example:
var breakingChanges = [
{
change: 'column.remove',
schemaId: '1',
columnId: '1',
oldColumn: {
name: 'id',
type: 'integer'
}
}
];
differ.containsBreakingChanges(breakingChanges);
public diffProject(projectId: String, oldProject: Project, project: Project): Changes source
Get changes by comparing 2 projects
Example:
var oldProject = null;
var project = {
'1': {
name: 'users',
columns: {
'1': {
name: 'id',
type: 'uuid'
}
}
}
};
var changes = differ.diffProject(projectId, oldProject, project);
public diffProjects(oldProjects: Projects, projects: Projects): Changes source
Get changes by comparing 2 sets of projects
public diffSchema(projectId: String, schemaId: String, oldSchema: Schema, schema: Schema): Changes source
Get changes by comparing 2 schemas
Example:
var oldSchema = {};
var schema = {
name: 'users',
columns: {
'1': {
name: 'id',
type: 'uuid'
}
}
};
var changes = differ.diffSchema(schemaId, oldSchema, schema);