Skip to content
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

Allow using shorthand types in other shorthands #343

Closed
tshelburne opened this issue Oct 11, 2018 · 5 comments
Closed

Allow using shorthand types in other shorthands #343

tshelburne opened this issue Oct 11, 2018 · 5 comments

Comments

@tshelburne
Copy link

For example:

exports.shorthands = {
  ref: {type: `integer`, onDelete: `cascade`},
  user: {type: `ref`, references: `users`},
}

This also currently doesn't work if the shorthand was defined in an earlier migration file.

@dolezel
Copy link
Contributor

dolezel commented Oct 16, 2018

Hmm, it can be to complicated and can lead to cyclic definition.
I can suggest to use

const ref = {type: `integer`, onDelete: `cascade`}
exports.shorthands = {
  ref,
  user: { ...ref, references: `users`},
}

@dolezel dolezel closed this as completed Oct 16, 2018
@tshelburne
Copy link
Author

If I submitted a PR that checked for a cyclic definition would you consider it?

@dolezel
Copy link
Contributor

dolezel commented Oct 22, 2018

Sure, you can look on it :)

@dolezel
Copy link
Contributor

dolezel commented Oct 24, 2018

Got some time to look on it ;-)

@tshelburne
Copy link
Author

Oh wow, that was fast. I'm used to tickets lasting for a little while.

Thanks!

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

No branches or pull requests

2 participants