diesel-rs / diesel

A safe, extensible ORM and Query Builder for Rust
https://diesel.rs
Apache License 2.0
12.71k stars 1.07k forks source link

[cli] MySQL Diesel only supports tables with primary keys. #2786

Open Dragonrun1 opened 3 years ago

Dragonrun1 commented 3 years ago

Setup

set DATABASE_UR with DB server URL.

Make new migration which contents:

CREATE TABLE junk (
    id BIGINT(20) UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
    something VARCHAR(20)
);

-- OR --

CREATE TABLE junk (
    id BIGINT(20) UNSIGNED AUTO_INCREMENT NOT NULL,
    something VARCHAR(20),
    PRIMARY KEY (id)
);

-- OR --

Any other valid SQL syntax to make a table with a PRIMARY KEY

Versions

Problem Description

do: diesel migration run

What is the expected output?

Running migration 2021-05-18-193949_junk

What is the actual output?

Running migration 2021-05-18-193949_junk
Diesel only supports tables with primary keys. Table junk has no primary key

Checklist

weiznich commented 1 year ago

@COREjake This issue is about a mysql specific problem. Your comment about postgres specific problems seems to be not right here. Please do not add these off-topic comments to existing issues.

tyrypyrking commented 1 year ago

Your comment about postgres specific problems seems to be not right here.

Sorry if it's like that, but this is the only thread on this I found. My finding was that error is too vague and ambiguous. Without the necessary privilege you can still get the same error and wording will be misleading to say the least. I'm removing myself from this discussion as it's indeed not the right place, furthermore I solved my issue.