I'm trying to create a migration with Diesel and an SQLite database and continue to get the following error:
Diesel only supports tables with primary keys. Table cycles has no primary key
However, I've whittled down the table to only have a primary key. Here's my entire up.sql file:
CREATE TABLE cycles (
id INTEGER PRIMARY KEY,
);
For completeness, here's my migration command:
diesel migration run --database-url ~/.config/cycles/dev.sqlite
In case it helps, here's my diesel.toml:
# For documentation on how to configure this file,
# see https://diesel.rs/guides/configuring-diesel-cli
[print_schema]
file = "src-tauri/src/schema.rs"
custom_type_derives = ["diesel::query_builder::QueryId"]
[migrations_directory]
dir = "migrations"
What am I missing?
The provided migration does not reproduce the error in your question. For me applying the migration fails with the following error message:
After fixing the syntax error pointed out in the error message
dieselcorrectly generates the followingschema.rsfile for me: