-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
adds an option to control whether columns are inserted by default #4035
Conversation
Shall we deprecate |
I'd be happy to include that in this PR, given that you're in favor of it. To deprecate something in typeorm, is it sufficient to add a |
correct. Feel free to do that if you are able to! |
@pleerock I was tracing the current |
@paulfitz maybe you just deprecate it and introduce new update: boolean parameter that would do what readonly supposed to do? I won't break any exist functionality, right? |
This adds an `insert` option, analogous to the existing `select` and `readonly` options, for use in the `Column` decorator. Just like a column specified with `@Column({select: false})` will not be selected by default in queries, and a column with `@Column({readonly: true;})` will not be `UPDATE`d, a column specified with `@Column({insert: false})` will not be inserted by default in `INSERT`s. I believe this fixes typeorm#85, and is relevant to (though not the same as) the work in typeorm#2150.
67703b9
to
afe59ff
Compare
@pleerock I took a shot at implementing the Edit: oops, I accidentally fixed the |
CHANGELOG.md
Outdated
@@ -17,6 +17,7 @@ feel free to ask us and community. | |||
* sqlite date hydration is susceptible to corruption ([#3949](https://github.com/typeorm/typeorm/issues/3949)) | |||
* fixed mongodb uniques, support 3 ways to define uniques ([#3986](https://github.com/typeorm/typeorm/pull/3986)) | |||
* fixed mongodb TTL index ([#4044](https://github.com/typeorm/typeorm/pull/4044)) | |||
* deprecate column `readonly` option in favor of `update` and `insert` options ([#4035](https://github.com/typeorm/typeorm/pull/4035)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since 0.2.17 has been released this should be moved into new section. damn hate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing I can think of which could minimize this is to use some kind of changelog generator, but to make it work we would have to write commit messages in specific format.
We wouldn't have to fore contributors to do so - changing messages of merge commits should be enough. Which means a bit more work when merging PRs(decide if change should be seen in changelog, and what entry should be added there).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it will be our job - change title before merging. Thats okay I think... we need to find some good changelog generator solution then.
Thank you very much for this amazing PR! |
This adds an
insert
option, analogous to the existingselect
andreadonly
options, for use in theColumn
decorator. Just like a column specified with@Column({select: false})
will not be selected by default in queries, and a column with@Column({readonly: true;})
will not beUPDATE
d, a column specified with@Column({insert: false})
will not be inserted by default inINSERT
s.Adds a test to verify that an entity can be created even if an alleged column is not present, if that column is marked
insert: false
.I believe this fixes #85, and is relevant to (though not the same as) the work in #2150.