sea-orm icon indicating copy to clipboard operation
sea-orm copied to clipboard

Mark primary key columns as unique in sea-orm-codegen

Open SZenglein opened this issue 1 year ago • 0 comments

PR Info

This is a relatively simple change where sea-orm-cli did not mark primary key columns as unique, resulting in a has_many relation where a has_one would be correct. Issue #1884 offers a complete example where the problem occurs.

I only tested this for SQLite, but it should be pretty universal.

Maybe related: https://github.com/SeaQL/sea-orm/pull/1629 Fixes: #1884

New Features

None

Bug Fixes

sea-orm-cli no longer incorrectly assumes primary key columns as non-unique.

Breaking Changes

Code generation will be different in some cases (has_many replaced by has_one).

SZenglein avatar May 24 '24 09:05 SZenglein