Skip to content

Conversation

@Shubham8287
Copy link
Contributor

@Shubham8287 Shubham8287 commented Aug 18, 2025

Description of Changes

PR introduces support for column-level default values via a new #[default(...)] attribute.

It also validates, default macro is not used along with primary_key, unique or auto_inc.

API and ABI breaking changes

NA

Expected complexity level and risk

2

Testing

Start using macro in module-test.

@Shubham8287 Shubham8287 requested a review from gefjon August 18, 2025 12:57
@bfops bfops added release-any To be landed in any release window backward-compatible release-1.4 labels Aug 18, 2025
Base automatically changed from jgilles/add_columns to master August 20, 2025 09:09
@Shubham8287
Copy link
Contributor Author

Thanks, I will hold this PR to merge until we merge the other PR to make this functional.

@Shubham8287 Shubham8287 added this pull request to the merge queue Sep 16, 2025
Merged via the queue into master with commit cfb185a Sep 16, 2025
25 checks passed
bfops added a commit that referenced this pull request Sep 22, 2025
bfops added a commit that referenced this pull request Sep 22, 2025
@egormanga
Copy link
Contributor

How to use these default values? Do we pass some sentinel value (as 0 with auto_inc), or omit the field (does Rust even allow this?), or anything else?

@gefjon
Copy link
Contributor

gefjon commented Sep 24, 2025

How to use these default values? Do we pass some sentinel value (as 0 with auto_inc), or omit the field (does Rust even allow this?), or anything else?

@egormanga These will be used with an upcoming feature that allows adding columns during "supervised" automigrations.

@egormanga
Copy link
Contributor

It would be great if those defaults were applied to missing columns when inserting via SQL. I'd love to see an issue on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backward-compatible release-1.4 release-any To be landed in any release window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants