Added diff to the tool
This commit is contained in:
@@ -6,9 +6,10 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"git.warky.dev/wdevs/relspecgo/pkg/models"
|
||||
"git.warky.dev/wdevs/relspecgo/pkg/writers"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Writer implements the writers.Writer interface for DCTX format
|
||||
@@ -43,9 +44,8 @@ func (w *Writer) WriteSchema(schema *models.Schema) error {
|
||||
}
|
||||
|
||||
tableSlice := make([]*models.Table, 0, len(schema.Tables))
|
||||
for _, t := range schema.Tables {
|
||||
tableSlice = append(tableSlice, t)
|
||||
}
|
||||
|
||||
tableSlice = append(tableSlice, schema.Tables...)
|
||||
|
||||
// Pass 1: Create fields and populate fieldGuidMap
|
||||
for i, table := range tableSlice {
|
||||
@@ -70,8 +70,8 @@ func (w *Writer) WriteSchema(schema *models.Schema) error {
|
||||
isDuplicate := false
|
||||
for _, existing := range allRelations {
|
||||
if existing.Name == rel.Name &&
|
||||
existing.FromTable == rel.FromTable &&
|
||||
existing.ToTable == rel.ToTable {
|
||||
existing.FromTable == rel.FromTable &&
|
||||
existing.ToTable == rel.ToTable {
|
||||
isDuplicate = true
|
||||
break
|
||||
}
|
||||
@@ -310,8 +310,8 @@ func (w *Writer) mapRelation(rel *models.Relationship, schema *models.Schema) mo
|
||||
// Create field mappings
|
||||
// NOTE: DCTX has backwards naming - ForeignMapping contains PRIMARY table fields,
|
||||
// and PrimaryMapping contains FOREIGN table fields
|
||||
var foreignMappings []models.DCTXFieldMapping // Will contain primary table fields
|
||||
var primaryMappings []models.DCTXFieldMapping // Will contain foreign table fields
|
||||
var foreignMappings []models.DCTXFieldMapping // Will contain primary table fields
|
||||
var primaryMappings []models.DCTXFieldMapping // Will contain foreign table fields
|
||||
|
||||
// Map foreign key columns (from foreign table) to PrimaryMapping
|
||||
for _, colName := range fkColumns {
|
||||
|
||||
Reference in New Issue
Block a user