SQL Table has primary key but error "Diesel only supports tables with primary keys. Table errors has no primary key"

Viewed 303

Going through diesel getting started, but adjusting for Mysql, I've been able to get this to work, and then fail, and then work again, then fail.

Where I am:

up.sql

CREATE TABLE errors 
(
    id INTEGER PRIMARY KEY AUTO_INCREMENT,
    matching_string VARCHAR(255) NOT NULL UNIQUE,
    reference_url TEXT NOT NULL,
    reference_case TEXT NOT NULL
)

down.sql

DROP TABLE errors;

When I run diesel commands to get the schema file populated, I get...

sh-3.2$ diesel migration run
Diesel only supports tables with primary keys. Table errors has no primary key

sh-3.2$ diesel migration redo
Rolling back migration 2021-09-21-202330_create_posts
Running migration 2021-09-21-202330_create_posts
Diesel only supports tables with primary keys. Table errors has no primary key

sh-3.2$ diesel migration revert
Rolling back migration 2021-09-21-202330_create_posts

sh-3.2$ diesel migration run
Running migration 2021-09-21-202330_create_posts
Diesel only supports tables with primary keys. Table errors has no primary key

I've tried to delete all tables, including the __diesel_schema_migrations table, without success.

0 Answers
Related