More Roundtrip tests
This commit is contained in:
@@ -38,7 +38,8 @@ type Schema struct {
|
||||
Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" xml:"-"`
|
||||
Scripts []*Script `json:"scripts,omitempty" yaml:"scripts,omitempty" xml:"scripts,omitempty"`
|
||||
Sequence uint `json:"sequence,omitempty" yaml:"sequence,omitempty" xml:"sequence,omitempty"`
|
||||
RefDatabase *Database `json:"ref_database,omitempty" yaml:"ref_database,omitempty" xml:"ref_database,omitempty"`
|
||||
RefDatabase *Database `json:"-" yaml:"-" xml:"-"` // Excluded to prevent circular references
|
||||
Relations []*Relationship `json:"relations,omitempty" yaml:"relations,omitempty" xml:"-"`
|
||||
}
|
||||
|
||||
// SQLName returns the schema name in lowercase
|
||||
@@ -58,7 +59,7 @@ type Table struct {
|
||||
Tablespace string `json:"tablespace,omitempty" yaml:"tablespace,omitempty" xml:"tablespace,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" xml:"-"`
|
||||
Sequence uint `json:"sequence,omitempty" yaml:"sequence,omitempty" xml:"sequence,omitempty"`
|
||||
RefSchema *Schema `json:"ref_schema,omitempty" yaml:"ref_schema,omitempty" xml:"ref_schema,omitempty"`
|
||||
RefSchema *Schema `json:"-" yaml:"-" xml:"-"` // Excluded to prevent circular references
|
||||
}
|
||||
|
||||
// SQLName returns the table name in lowercase
|
||||
@@ -96,7 +97,7 @@ type View struct {
|
||||
Comment string `json:"comment,omitempty" yaml:"comment,omitempty" xml:"comment,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty" yaml:"metadata,omitempty" xml:"-"`
|
||||
Sequence uint `json:"sequence,omitempty" yaml:"sequence,omitempty" xml:"sequence,omitempty"`
|
||||
RefSchema *Schema `json:"ref_schema,omitempty" yaml:"ref_schema,omitempty" xml:"ref_schema,omitempty"`
|
||||
RefSchema *Schema `json:"-" yaml:"-" xml:"-"` // Excluded to prevent circular references
|
||||
}
|
||||
|
||||
// SQLName returns the view name in lowercase
|
||||
@@ -119,7 +120,7 @@ type Sequence struct {
|
||||
OwnedByColumn string `json:"owned_by_column,omitempty" yaml:"owned_by_column,omitempty" xml:"owned_by_column,omitempty"`
|
||||
Comment string `json:"comment,omitempty" yaml:"comment,omitempty" xml:"comment,omitempty"`
|
||||
Sequence uint `json:"sequence,omitempty" yaml:"sequence,omitempty" xml:"sequence,omitempty"`
|
||||
RefSchema *Schema `json:"ref_schema,omitempty" yaml:"ref_schema,omitempty" xml:"ref_schema,omitempty"`
|
||||
RefSchema *Schema `json:"-" yaml:"-" xml:"-"` // Excluded to prevent circular references
|
||||
}
|
||||
|
||||
// SQLName returns the sequence name in lowercase
|
||||
@@ -184,8 +185,10 @@ type Relationship struct {
|
||||
Type RelationType `json:"type" yaml:"type" xml:"type"`
|
||||
FromTable string `json:"from_table" yaml:"from_table" xml:"from_table"`
|
||||
FromSchema string `json:"from_schema" yaml:"from_schema" xml:"from_schema"`
|
||||
FromColumns []string `json:"from_columns" yaml:"from_columns" xml:"from_columns"`
|
||||
ToTable string `json:"to_table" yaml:"to_table" xml:"to_table"`
|
||||
ToSchema string `json:"to_schema" yaml:"to_schema" xml:"to_schema"`
|
||||
ToColumns []string `json:"to_columns" yaml:"to_columns" xml:"to_columns"`
|
||||
ForeignKey string `json:"foreign_key" yaml:"foreign_key" xml:"foreign_key"`
|
||||
Properties map[string]string `json:"properties" yaml:"properties" xml:"-"`
|
||||
ThroughTable string `json:"through_table,omitempty" yaml:"through_table,omitempty" xml:"through_table,omitempty"` // For many-to-many
|
||||
@@ -292,14 +295,28 @@ func InitColumn(name, table, schema string) *Column {
|
||||
}
|
||||
|
||||
// InitIndex initializes a new Index with empty slices
|
||||
func InitIndex(name string) *Index {
|
||||
func InitIndex(name, table, schema string) *Index {
|
||||
return &Index{
|
||||
Name: name,
|
||||
Table: table,
|
||||
Schema: schema,
|
||||
Columns: make([]string, 0),
|
||||
Include: make([]string, 0),
|
||||
}
|
||||
}
|
||||
|
||||
// InitRelation initializes a new Relationship with empty slices
|
||||
func InitRelation(name, schema string) *Relationship {
|
||||
return &Relationship{
|
||||
Name: name,
|
||||
FromSchema: schema,
|
||||
ToSchema: schema,
|
||||
Properties: make(map[string]string),
|
||||
FromColumns: make([]string, 0),
|
||||
ToColumns: make([]string, 0),
|
||||
}
|
||||
}
|
||||
|
||||
// InitRelationship initializes a new Relationship with empty maps
|
||||
func InitRelationship(name string, relType RelationType) *Relationship {
|
||||
return &Relationship{
|
||||
|
||||
Reference in New Issue
Block a user