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

chore: migrate internal and keysend columns to be non null #442

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

im-adithya
Copy link
Member

Fixes #417

@im-adithya im-adithya force-pushed the task-invoice-migration branch from 26c69ac to afaf6fd Compare October 30, 2023 12:19
@im-adithya im-adithya requested review from kiwiidb and bumi October 30, 2023 12:19
@bumi
Copy link
Contributor

bumi commented Oct 31, 2023

I think we would need to set a default? or how does the value now get filled?

Internal bool `json:"-" bun:",nullzero"`
Keysend bool `json:"keysend" bun:",nullzero"`
Internal bool `json:"-" bun:",notnull,default:false"`
Keysend bool `json:"keysend" bun:",notnull,default:false"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they still use nullzero:
https://bun.uptrace.dev/guide/models.html#default

nullzero,notnull,default:false ?

I think if "" (blank) is set then bun converts it to NULL which then uses the default of false.

ALTER COLUMN keysend SET DEFAULT false;

ALTER TABLE invoices
ALTER COLUMN keysend SET NOT NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if a default is set, do we then still need a NOT NULL constraint?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes because I've seen the db values go from false to NULL while running integration_tests for some reason

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

Successfully merging this pull request may close these issues.

Default values for internal / keysend
2 participants