-
Notifications
You must be signed in to change notification settings - Fork 893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Foreign key name #1423
Comments
Hey @michaelkub! It's great to hear from you 😃 There's no way to configure it in the schema atm, but I can add it to the edge annotation later today and tag you. If you're looking for a workaround, you can use a migration-hook to change the foreign-key symbol and remove this workaround after we add this option. client.Schema.Create(
ctx,
schema.WithHooks(func(next schema.Creator) schema.Creator {
return schema.CreateFunc(func(ctx context.Context, tables ...*schema.Table) error {
tables[i].ForeignKeys[j].Symbol = "<symbol>"
return next.Create(ctx, tables...)
})
}),
) BTW, I'd be happy to share with you my work on the new migration API. Feel free to join our Ent Slack channel and ping me privately if you're interested 🙏 |
Hello everyone ,
Is it possible to provide foreign key name ?
As I saw it is autogenerated by the following pattern:
Symbol: fmt.Sprintf("%s_%s_%s", owner.Name, ref.Name, e.Name)
but sometimes it is required to provide own name
The text was updated successfully, but these errors were encountered: