Skip to content

Conversation

@jhoward-lm
Copy link
Contributor

@jhoward-lm jhoward-lm commented Jun 9, 2024

This PR contains fixes for schema unique index definitions and Document relations.

Document

  • Use Metadata.ID string as ID
  • Set Document as owner of its NodeList and Metadata edges (reverse edge.To() and edge.From() definitions in schemas)
  • Store document ID (which is now Metadata.ID) as a field in NodeList schema

ExternalReference

  • Fix unique index to include URL and Type fields

NodeList

  • Fix unique index to include DocumentID field

Miscellaneous

  • Fix backend debug option (client was nil at the time of calling its Debug() method)

Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
Signed-off-by: Jonathan Howard <jonathan.w.howard@lmco.com>
@jhoward-lm
Copy link
Contributor Author

@eddiezane @houdini91 @cpanato requesting review, I couldn't add to the reviewers directly

All changes are auto-generated except:

  • internal/backends/ent/schema/*.go
  • backends/ent/store.go
  • backends/ent/backend.go
  • Makefile

Copy link
Member

@puerco puerco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One non-blocking question but looks good to me


func (backend *Backend) Debug() *Backend {
backend.Options.Debug = true
backend.client.Debug()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this breaking something with the client? or why would we not want to debug the client?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, at this point, client isn't initialized yet. It just sets the debug flag in the options, then in InitClient() this gets run:

	clientOpts := []ent.Option{}
	if backend.Options.Debug {
		clientOpts = append(clientOpts, ent.Debug())
	}

	client, err := ent.Open("sqlite3", backend.Options.DatabaseFile+dsnParams, clientOpts...)

@puerco puerco merged commit 32a66cb into protobom:main Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants