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

Falsey column defaults not used #45

Open
harto opened this issue Sep 17, 2019 · 1 comment
Open

Falsey column defaults not used #45

harto opened this issue Sep 17, 2019 · 1 comment

Comments

@harto
Copy link

harto commented Sep 17, 2019

Column default values like '' or false aren't used when a value is omitted for that column.

For example, if I have a table foo with a column bar that has a default value of '', and I don't provide a value for bar in my call to bulk_insert, the newly-inserted row will have a bar value of NULL, and not '' like I expect.

The issue seems to be the use of #present? to determine a column has a default value:

if column.default.present?

@mberlanda
Copy link
Collaborator

Hi @harto , thank you very much for raising his issue. Would you be able to short snippet to reproduce the issue?

If you can write a unit test and suggest a change, I will be happy to review your pr

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