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

Make Insertable and Updatable interfaces for updatable view (using trigger instead of insert/update) writable #123

Open
jcassee opened this issue Jul 22, 2022 · 2 comments

Comments

@jcassee
Copy link

jcassee commented Jul 22, 2022

As the docs say, "[...] Updatable and Insertable interfaces for tables and views that aren’t writable are now { [key: string]: never } instead of {}.

I have a view that I have made updatable by adding triggers INSTEAD OF CREATE and INSTEAD OF UPDATE. See for example this article.

Is it possible to tell Zapatos that the Insertable and Updatable interfaces should be populated?

@jawj
Copy link
Owner

jawj commented Sep 21, 2022

Sorry for the delay.

I can see this is an important feature. It's not currently supported, but I think it should be possible without too much trouble.

I think we might need a new generate-time config option, possibly tableOptions, to sit alongside the existing columnOptions.

Then you might add something like the following to your config:

"tableOptions": {
  "myTable": {
    "insertable": true,
    "updatable": true
  }
}

(I guess we might also allow these to be false to override behaviour in the other direction).

Does this sound sensible?

@jcassee
Copy link
Author

jcassee commented Sep 21, 2022

Yes, this sounds great!

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