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

Support nullable foreign keys. #6

Open
donut opened this issue Oct 9, 2017 · 1 comment
Open

Support nullable foreign keys. #6

donut opened this issue Oct 9, 2017 · 1 comment

Comments

@donut
Copy link

donut commented Oct 9, 2017

I have a table which has a field that is a nullable foreign key. When I try to compile I get this:

I have a table with a primary key that is of type VARCHAR and is referenced by another table, but it looks like Sequoia only supports. At least, when I try to compile I get this:

Error: Unbound value Field.Null.foreign_key

Example:

open Sequoia_mysql

module URL = struct
  include (val table "url")
  let id = Field.int "id"
  (* ... *)
end

module Use = struct
  include (val table "use")
  let id = Field.int "id"
  let url = Field.foreign_key "url" ~references:URL.id
  let referer = Field.Null.foreign_key "referer" ~references:URL.id (* <- error *)
  (* ... *)
end
@andrenth
Copy link
Owner

There's no support for nullable foreign keys. I could add this, but I'm probably not adding new features until I can figure out a non-hackish way to implement the PPX extension. Currently there are issues when tables and queries are defined in separate files which make the library a bit annoying to use in practice.

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