I am also having issues with running diesel migration redo in order to drop my table. I am successfully able to create a table on postgres 14.x, but the redo command specifically complains that the directory is invalid, even though the only things in the directory are both the up/down.sql files.
>> <master>$ pwd
../myprojecti/migrations/2021-10-24-055129_create_user
>> <master>$ ls
down.sql up.sql
>> <master>$ cat up.sql
create table users (
id uuid default uuid_generate_v4 (),
username varchar not null,
password varchar not null,
email varchar not null,
primary key (id)
)
>> <master>$ cat down.sql
drop table users
>> <master>$ diesel migration redo
Failed with: Invalid migration directory, the directory's name should be <timestamp>_<name_of_migration>, and it should only contain up.sql and down.sql.
Yup, I feel like I'm missing something, not sure why its able to run a migration, but not a revert/redo.
>> <master>$ pwd
/home/me/Documents/my-project
>> <master>$ ls
Cargo.lock Cargo.toml diesel.toml migrations README.md src target
>> <master>$ diesel migration revert
Failed with: Invalid migration directory, the directory's name should be <timestamp>_<name_of_migration>, and it should only contain up.sql and down.sql.
>> <master>$ diesel migration redo
Failed with: Invalid migration directory, the directory's name should be <timestamp>_<name_of_migration>, and it should only contain up.sql and down.sql.
Ok, I found the issue? It's really odd but it seems like literally moving the generated migration out of the migrations folder and back into it somehow allowed the migration to be reverted?? Really, really, really weird.