Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
latolukasz committed Sep 1, 2021
1 parent 5ba8eff commit 797353c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions table_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ type TableSchema interface {
GetReferences() []string
GetColumns() []string
GetSchemaChanges(engine *Engine) (has bool, alters []Alter)
GetUsage(registry ValidatedRegistry) map[reflect.Type][]string
}

type tableSchema struct {
Expand Down
7 changes: 6 additions & 1 deletion validated_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (

type validatedRegistryEntity struct {
ORM
ID uint
ID uint
Ref *validatedRegistryEntity
}

type validatedRegistryNotRegisteredEntity struct {
Expand Down Expand Up @@ -71,4 +72,8 @@ func TestValidatedRegistry(t *testing.T) {
assert.PanicsWithError(t, "entity 'beeorm.validatedRegistryNotRegisteredEntity' is not registered", func() {
validated.GetTableSchemaForEntity(&validatedRegistryNotRegisteredEntity{})
})

usage := validated.GetTableSchemaForEntity(entity).GetUsage(validated)
assert.NotNil(t, usage)
assert.Len(t, usage, 1)
}

0 comments on commit 797353c

Please sign in to comment.