mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-20 02:24:58 -05:00
some feedback
This commit is contained in:
@@ -183,7 +183,7 @@ func (fk ForeignKey) ValidateReferencedTableSchema(sch schema.Schema) error {
|
||||
fk.Name, fk.ReferencedTableName)
|
||||
}
|
||||
}
|
||||
if (fk.ReferencedTableIndex != "" && !sch.Indexes().Contains(fk.ReferencedTableIndex)) || (fk.ReferencedTableIndex == "" && sch.GetPKCols().Size() == 0) {
|
||||
if (fk.ReferencedTableIndex != "" && !sch.Indexes().Contains(fk.ReferencedTableIndex)) || (fk.ReferencedTableIndex == "" && sch.GetPKCols().Size() >= len(fk.ReferencedTableColumns)) {
|
||||
return fmt.Errorf("foreign key `%s` has entered an invalid state, referenced table `%s` is missing the index `%s`",
|
||||
fk.Name, fk.ReferencedTableName, fk.ReferencedTableIndex)
|
||||
}
|
||||
@@ -203,7 +203,7 @@ func (fk ForeignKey) ValidateTableSchema(sch schema.Schema) error {
|
||||
return fmt.Errorf("foreign key `%s` has entered an invalid state, table `%s` has unexpected schema", fk.Name, fk.TableName)
|
||||
}
|
||||
}
|
||||
if (fk.TableIndex != "" && !sch.Indexes().Contains(fk.TableIndex)) || (fk.TableIndex == "" && sch.GetPKCols().Size() == 0) {
|
||||
if (fk.TableIndex != "" && !sch.Indexes().Contains(fk.TableIndex)) || (fk.TableIndex == "" && sch.GetPKCols().Size() >= len(fk.TableColumns)) {
|
||||
return fmt.Errorf("foreign key `%s` has entered an invalid state, table `%s` is missing the index `%s`",
|
||||
fk.Name, fk.TableName, fk.TableIndex)
|
||||
}
|
||||
|
||||
@@ -69,16 +69,16 @@ type indexImpl struct {
|
||||
}
|
||||
|
||||
func NewIndex(name string, tags, allTags []uint64, indexColl IndexCollection, props IndexProperties) Index {
|
||||
var idxColl *indexCollectionImpl
|
||||
var indexCollImpl *indexCollectionImpl
|
||||
if indexColl != nil {
|
||||
idxColl = indexColl.(*indexCollectionImpl)
|
||||
indexCollImpl = indexColl.(*indexCollectionImpl)
|
||||
}
|
||||
|
||||
return &indexImpl{
|
||||
name: name,
|
||||
tags: tags,
|
||||
allTags: allTags,
|
||||
indexColl: idxColl,
|
||||
indexColl: indexCollImpl,
|
||||
isUnique: props.IsUnique,
|
||||
isUserDefined: props.IsUserDefined,
|
||||
comment: props.Comment,
|
||||
|
||||
Reference in New Issue
Block a user