Diesel cli migration run doesnt work

I am following the getting started guide.
I set up the db using diesel setup
then created a migration using diesel migration generate users
and filled the generated files up and down sql
tried to run the migration diesel migration run
at this point, I get the error message saying schema users does not exist
according to the getting started guide it should just work but seems like the cli is broken. Am I doing something wrong or is it really broken?

Diesels CLI is covered quite extensively with test + those are run as part of the CI setup, so it's really unlikely that the CLI is "broken".

Your error message indicates some problem with the SQL you've put into the migration. Unfortunately this information (alongside many other relevant details like which database system you are using, which version of diesel CLI, …) is missing from your posting, so it's not really possible to help you here any further.

I shared all the details in the bug report I created but you replied as I am imagining things and diesel cli cannot have bugs.

All I did was to follow the getting started word by work

  • create a project
  • cargo add diesel --features postgres
  • cargo install --no-default-features --features postgres
  • echo 'DATABASE_URL="my db str" > .env'
  • diesel setup (successfully creates the db and a migrations table in it)
  • diesel migration generate users (generates up and down SQL under migrations/$(date)_users/ folder)
  • create up and down SQL files ( I also checked the validity of the files directly using `psql -f ./migrations/date_users/up.sql and down.sql upon the error and the SQL is correct works as expected)
  • when I run diesel migration run at this point I get the error message I provided on the bug report you tell I am imagining

I understand you put a lot of effort into this software but it's just funny you question people's sanity when someone suggests that there's a bug in your software. You tell its impossible for your software to have bugs yet there is a bug I am affected according to the getting started guide you wrote the schema should be created by the diesel cli yet I get an error saying it doesn't exist meaning it doesn't do the job it's supposed to do.

I shared all the details in the bug report I created but you replied as I am imagining things and diesel cli cannot have bugs.

I do not claim that it is not possible that diesel cli can have bugs, I only say that the scenario that you described is highly unlikely as this is something that at least the CI guarantees to work. I closed you bug report as it is missing quite a lot required information to reproduce anything. If you add it there + we can verify that it is really a bug in diesel noone says that we won't reopen the bug report. It's just that most people don't border adding any relevant information at all even if they are requested.

Specifically your bug report (and also your posts here) miss the following information:

  • Which database version do you use?
  • What is the content of up.sql and down.sql files?
  • When exactly do the error message happen?
  • Is that the complete error message as emitted by diesel CLI? If not what's the complete error message.
  • Is there anything else in your database at the moment the error happens? Can you provide a corresponding database dump?

If your don't add this information it's highly unlikely anyone can tell you where something got wrong.

In the best case you can provide an script that someone else can just use to reproduce the error message. If that's not possible for whatever reason just answering this questions will likely already help to tell what's wrong.

This is likely my last post at this topic till the required information are there.

I understand you put a lot of effort into this software but it's just funny you question people's sanity when someone suggests that there's a bug in your software.

I'm not saying it's impossible, only that it is highly unlikely because again: We test this as part of the CI setup.

as I stated both in the bug report and here I was just experimenting with diesel and created a brand new project and db is already created by diesel itself at the diesel setup stage theres literally no other detail to add diesel setup creates a db and cannot create the table requiring manual schema or something I just don't understand what details do you need else just follow your own getting started guide. Either the getting started guide is wrong and theres some extra job to be done not mentioned there or cli doesn't know how to run sql files in up.sql also I have added the error message exactly as well in the bug report you were quick to ignore telling its impossible for this bug to happen

I don't understand what's so hard to just answer the questions stated above. To reiterate what I have already written: I do not doubt that you see this error happen as described. The problem is that I cannot reproduce the problem in any way, so I need to have more information. To be extra clear here: No I cannot reproduce that problem on my local system following the getting started guide. You seem to be certain that this is definitively an issue in diesel and it must be easy to reproduce, but that's not the case. So again: Either you provide the requested information or noone can help you. Insulting any person that tries to help you will definitively not bring you any help. That written: This is definitively my last comment here, at least if you are not able to just answer the question.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.