mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-26 10:18:56 -06:00
added BATS, fix nil panic
This commit is contained in:
@@ -977,6 +977,9 @@ func (root *RootValue) ValidateForeignKeysOnSchemas(ctx context.Context) (*RootV
|
||||
func GetAllTagsForRoots(ctx context.Context, roots ...*RootValue) (tags schema.TagMapping, err error) {
|
||||
tags = make(schema.TagMapping)
|
||||
for _, root := range roots {
|
||||
if root == nil {
|
||||
continue
|
||||
}
|
||||
err = root.IterTables(ctx, func(tblName string, _ *Table, sch schema.Schema) (stop bool, err error) {
|
||||
for _, t := range sch.GetAllCols().Tags {
|
||||
tags.Add(t, tblName)
|
||||
|
||||
@@ -412,3 +412,21 @@ SQL
|
||||
[ $status -eq 0 ]
|
||||
[[ $output =~ "clan_home_level | price_teleport | 0" ]] || false
|
||||
}
|
||||
|
||||
@test "drop-create: ensure no tag collisions" {
|
||||
dolt sql -q "CREATE TABLE my_table (pk int primary key)"
|
||||
dolt commit -Am "added my_table"
|
||||
|
||||
run dolt schema tags
|
||||
[ $status -eq 0 ]
|
||||
[[ $output =~ "my_table | pk | 2803" ]] || false
|
||||
|
||||
dolt sql -q "DROP TABLE my_table"
|
||||
dolt sql -q "CREATE TABLE mytable (pk int primary key)"
|
||||
dolt sql -q "CREATE TABLE my_table (pk int primary key)"
|
||||
|
||||
run dolt schema tags
|
||||
[ $status -eq 0 ]
|
||||
[[ $output =~ "my_table | pk | 2803" ]] || false
|
||||
[[ $output =~ "mytable | pk | 11671" ]] || false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user