Database diagrams editor that allows you to visualize and design your DB with a single query.
TypeScript databasedbdb-migrationeditorerdmariadbmssqlmysqlpostgresqlreactreact-flowschema-migrationssqlsqlitetypescriptvisualizationxyflow
fix: change diff new id field (#1027)
Guy Ben-Aharon0af777584fe9
diff --git a/src/lib/domain/diff/area-diff.ts b/src/lib/domain/diff/area-diff.tsindex 02bea1dc..b533ec1a 100644--- a/src/lib/domain/diff/area-diff.ts+++ b/src/lib/domain/diff/area-diff.ts@@ -19,6 +19,7 @@ export interface AreaDiffChanged {object: 'area';type: 'changed';areaId: string;+ newAreaId: string;attribute: AreaDiffAttribute;oldValue?: string | number | null;newValue?: string | number | null;@@ -28,6 +29,7 @@ export const AreaDiffChangedSchema: z.ZodType<AreaDiffChanged> = z.object({object: z.literal('area'),type: z.literal('changed'),areaId: z.string(),+ newAreaId: z.string(),attribute: areaDiffAttributeSchema,oldValue: z.union([z.string(), z.number(), z.null()]).optional(),newValue: z.union([z.string(), z.number(), z.null()]).optional(),diff --git a/src/lib/domain/diff/diff-check/diff-check.ts b/src/lib/domain/diff/diff-check/diff-check.tsindex 64e7c68d..f5ea48ae 100644--- a/src/lib/domain/diff/diff-check/diff-check.ts+++ b/src/lib/domain/diff/diff-check/diff-check.ts@@ -377,6 +377,7 @@ function compareTables({object: 'table',type: 'changed',tableId: oldTable.id,+ newTableId: newTable.id,attribute: 'name',newValue: newTable.name,oldValue: oldTable.name,@@ -402,6 +403,7 @@ function compareTables({object: 'table',type: 'changed',tableId: oldTable.id,+ newTableId: newTable.id,attribute: 'comments',newValue: newTable.comments,oldValue: oldTable.comments,@@ -429,6 +431,7 @@ function compareTables({object: 'table',type: 'changed',tableId: oldTable.id,+ newTableId: newTable.id,attribute: 'color',newValue: newTable.color,oldValue: oldTable.color,@@ -451,6 +454,7 @@ function compareTables({object: 'table',type: 'changed',tableId: oldTable.id,+ newTableId: newTable.id,attribute: 'x',newValue: newTable.x,oldValue: oldTable.x,@@ -473,6 +477,7 @@ function compareTables({object: 'table',type: 'changed',tableId: oldTable.id,+ newTableId: newTable.id,attribute: 'y',newValue: newTable.y,oldValue: oldTable.y,@@ -498,6 +503,7 @@ function compareTables({object: 'table',type: 'changed',tableId: oldTable.id,+ newTableId: newTable.id,attribute: 'width',newValue: newTable.width,oldValue: oldTable.width,@@ -823,6 +829,7 @@ function compareFieldProperties({object: 'field',type: 'changed',fieldId: oldField.id,+ newFieldId: newField.id,tableId,attribute,oldValue: oldField[attribute] ?? '',@@ -1045,6 +1052,7 @@ function compareIndexProperties({object: 'index',type: 'changed',indexId: oldIndex.id,+ newIndexId: newIndex.id,tableId,attribute,oldValue: oldIndex[attribute],@@ -1231,6 +1239,7 @@ function compareAreas({object: 'area',type: 'changed',areaId: oldArea.id,+ newAreaId: newArea.id,attribute: 'name',newValue: newArea.name,oldValue: oldArea.name,@@ -1255,6 +1264,7 @@ function compareAreas({object: 'area',type: 'changed',areaId: oldArea.id,+ newAreaId: newArea.id,attribute: 'color',newValue: newArea.color,oldValue: oldArea.color,@@ -1276,6 +1286,7 @@ function compareAreas({object: 'area',type: 'changed',areaId: oldArea.id,+ newAreaId: newArea.id,attribute: 'x',newValue: newArea.x,oldValue: oldArea.x,@@ -1297,6 +1308,7 @@ function compareAreas({object: 'area',type: 'changed',areaId: oldArea.id,+ newAreaId: newArea.id,attribute: 'y',newValue: newArea.y,oldValue: oldArea.y,@@ -1321,6 +1333,7 @@ function compareAreas({object: 'area',type: 'changed',areaId: oldArea.id,+ newAreaId: newArea.id,attribute: 'width',newValue: newArea.width,oldValue: oldArea.width,@@ -1345,6 +1358,7 @@ function compareAreas({object: 'area',type: 'changed',areaId: oldArea.id,+ newAreaId: newArea.id,attribute: 'height',newValue: newArea.height,oldValue: oldArea.height,@@ -1456,6 +1470,7 @@ function compareNotes({object: 'note',type: 'changed',noteId: oldNote.id,+ newNoteId: newNote.id,attribute: 'content',newValue: newNote.content,oldValue: oldNote.content,@@ -1480,6 +1495,7 @@ function compareNotes({object: 'note',type: 'changed',noteId: oldNote.id,+ newNoteId: newNote.id,attribute: 'color',newValue: newNote.color,oldValue: oldNote.color,@@ -1501,6 +1517,7 @@ function compareNotes({object: 'note',type: 'changed',noteId: oldNote.id,+ newNoteId: newNote.id,attribute: 'x',newValue: newNote.x,oldValue: oldNote.x,@@ -1522,6 +1539,7 @@ function compareNotes({object: 'note',type: 'changed',noteId: oldNote.id,+ newNoteId: newNote.id,attribute: 'y',newValue: newNote.y,oldValue: oldNote.y,@@ -1546,6 +1564,7 @@ function compareNotes({object: 'note',type: 'changed',noteId: oldNote.id,+ newNoteId: newNote.id,attribute: 'width',newValue: newNote.width,oldValue: oldNote.width,@@ -1570,6 +1589,7 @@ function compareNotes({object: 'note',type: 'changed',noteId: oldNote.id,+ newNoteId: newNote.id,attribute: 'height',newValue: newNote.height,oldValue: oldNote.height,diff --git a/src/lib/domain/diff/field-diff.ts b/src/lib/domain/diff/field-diff.tsindex 93d4ad23..35a35271 100644--- a/src/lib/domain/diff/field-diff.ts+++ b/src/lib/domain/diff/field-diff.ts@@ -26,6 +26,10 @@ export const fieldDiffAttributeSchema: z.ZodType<FieldDiffAttribute> = z.union([z.literal('unique'),z.literal('nullable'),z.literal('comments'),+ z.literal('characterMaximumLength'),+ z.literal('precision'),+ z.literal('scale'),+ z.literal('increment'),]);export interface FieldDiffAdded<T = DBField> {@@ -64,6 +68,7 @@ export interface FieldDiffChanged {object: 'field';type: 'changed';fieldId: string;+ newFieldId: string;tableId: string;attribute: FieldDiffAttribute;oldValue: string | boolean | DataType | number;@@ -74,6 +79,7 @@ export const fieldDiffChangedSchema: z.ZodType<FieldDiffChanged> = z.object({object: z.literal('field'),type: z.literal('changed'),fieldId: z.string(),+ newFieldId: z.string(),tableId: z.string(),attribute: fieldDiffAttributeSchema,oldValue: z.union([z.string(), z.boolean(), dataTypeSchema]),diff --git a/src/lib/domain/diff/index-diff.ts b/src/lib/domain/diff/index-diff.tsindex 379e3ffa..50a542a6 100644--- a/src/lib/domain/diff/index-diff.ts+++ b/src/lib/domain/diff/index-diff.ts@@ -46,6 +46,7 @@ export interface IndexDiffChanged {object: 'index';type: 'changed';indexId: string;+ newIndexId: string;tableId: string;attribute: IndexDiffAttribute;oldValue?: string | boolean | string[] | IndexType | null;@@ -56,6 +57,7 @@ export const indexDiffChangedSchema: z.ZodType<IndexDiffChanged> = z.object({object: z.literal('index'),type: z.literal('changed'),indexId: z.string(),+ newIndexId: z.string(),tableId: z.string(),attribute: indexDiffAttributeSchema,oldValue: zdiff --git a/src/lib/domain/diff/note-diff.ts b/src/lib/domain/diff/note-diff.tsindex 5cebb1fc..53c5f379 100644--- a/src/lib/domain/diff/note-diff.ts+++ b/src/lib/domain/diff/note-diff.ts@@ -19,6 +19,7 @@ export interface NoteDiffChanged {object: 'note';type: 'changed';noteId: string;+ newNoteId: string;attribute: NoteDiffAttribute;oldValue?: string | number | null;newValue?: string | number | null;@@ -28,6 +29,7 @@ export const NoteDiffChangedSchema: z.ZodType<NoteDiffChanged> = z.object({object: z.literal('note'),type: z.literal('changed'),noteId: z.string(),+ newNoteId: z.string(),attribute: noteDiffAttributeSchema,oldValue: z.union([z.string(), z.number(), z.null()]).optional(),newValue: z.union([z.string(), z.number(), z.null()]).optional(),diff --git a/src/lib/domain/diff/table-diff.ts b/src/lib/domain/diff/table-diff.tsindex faf22506..1341b34a 100644--- a/src/lib/domain/diff/table-diff.ts+++ b/src/lib/domain/diff/table-diff.ts@@ -19,6 +19,7 @@ export interface TableDiffChanged {object: 'table';type: 'changed';tableId: string;+ newTableId: string;attribute: TableDiffAttribute;oldValue?: string | number | null;newValue?: string | number | null;@@ -28,6 +29,7 @@ export const TableDiffChangedSchema: z.ZodType<TableDiffChanged> = z.object({object: z.literal('table'),type: z.literal('changed'),tableId: z.string(),+ newTableId: z.string(),attribute: tableDiffAttributeSchema,oldValue: z.union([z.string(), z.number(), z.null()]).optional(),newValue: z.union([z.string(), z.number(), z.null()]).optional(),