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

Using two columns as primary keys #138

Open
MagiPrince opened this issue Apr 9, 2024 · 0 comments
Open

Using two columns as primary keys #138

MagiPrince opened this issue Apr 9, 2024 · 0 comments

Comments

@MagiPrince
Copy link

Hi everyone,

I'm working with a simple database that uses two columns as primary keys for my table :

CREATE TABLE "exchange_rates" (
    "currency_name" VARCHAR(255) UNIQUE NOT NULL,
    "year_of_exchange" INT UNIQUE NOT NULL,
    "usd_exchange" NUMERIC NOT NULL,
    CONSTRAINT "exchange_rates_id" PRIMARY KEY ("currency_name", "year_of_exchange")
);

But when I try to create an element in this table from the motor-admin UI, it returns me the following error :

Unknown primary key for table exchange_rates in model ExchangeRate.

Screenshot from 2024-04-09 15-39-40

Are the use of two columns as primary keys not supported by motor-admin, as it works just fine when creating directly the element inside the db, or I am missing something ?

Thanks !

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