mirror of
https://github.com/ent/ent.git
synced 2026-03-05 19:35:23 +03:00
dialect/sql/schema: qualify if schema is given (#4346)
This commit is contained in:
@@ -937,10 +937,6 @@ func (a *Atlas) realm(tables []*Table) (*schema.Realm, error) {
|
||||
ss := slices.SortedFunc(maps.Values(sm), func(a, b *schema.Schema) int {
|
||||
return strings.Compare(a.Name, b.Name)
|
||||
})
|
||||
// In case there only is one schema, do not qualify the schema name.
|
||||
if len(ss) == 1 {
|
||||
ss[0].Name = ""
|
||||
}
|
||||
return &schema.Realm{Schemas: ss}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -325,5 +325,12 @@ CREATE VIEW $pets_without_fur$ ($id$, $name$, $owner_id$) AS SELECT id, name, ow
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, tt.expected, ac)
|
||||
})
|
||||
t.Run(n+" single schema", func(t *testing.T) {
|
||||
ac, err := Dump(context.Background(), tt.dialect, tt.version, tables[0:1])
|
||||
require.NoError(t, err)
|
||||
if tt.dialect != dialect.SQLite {
|
||||
require.True(t, strings.HasPrefix(ac, "-- Add new schema named \"s1\""), strings.Split(ac, "\n")[0])
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user