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

Issues with tables that do not have primary/unique keys #2141

Open
gitmalong opened this issue Mar 3, 2024 · 0 comments
Open

Issues with tables that do not have primary/unique keys #2141

gitmalong opened this issue Mar 3, 2024 · 0 comments

Comments

@gitmalong
Copy link
Sponsor

gitmalong commented Mar 3, 2024

Hi!

When creating a table that does not have a primary key attached

1) Not able to create table that do not has primary key

Workarounds in #485 do not work. Using a unique col instead does also not work in my use case with pg_partman (Execution Error: error returned from database: unique constraint on partitioned table must include all partitioning columns).

Motivation: I am trying to make use of https://github.com/pgpartman/pg_partman/blob/master/doc/pg_partman_howto.md#simple-time-based-1-partition-per-day which wants me to create a parent table without having a primary key.

2) Compile errors with misleading error messages

Expected behavior:

5  | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
   |                                   ^^^^^^^^^^^^^^^^^ the trait `sea_orm::IdenStatic` is not implemented for `entities::table_without_primary_key::PrimaryKey`

Actual behavior:

I am getting misleading error messages for tables that have primary keys and were not modified.

5  | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
   |                                   ^^^^^^^^^^^^^^^^^ the trait `sea_orm::IdenStatic` is not implemented for `entities::table_with_primary_key::PrimaryKey`

I found that seaorm cli for does not add #[sea_orm(primary_key)] to all tables when one of the tables is lacking of a primary key.

@gitmalong gitmalong changed the title Issues with tables that do not have primary keys Issues with tables that do not have primary/unique keys Mar 3, 2024
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

1 participant