Different CLI commands to get to the database

On my localhost development I have two ways to get to the database. In common is

cd /var/discourse
sudo ./launcher enter app --skip-prereqs

* the --skip-prereqs is because autoclean, autoremove and launcher cleanup fail to clean up enough room for some reason that I haven’t determined yet and I can’t enter app without it.

I can then either

exec rails db

or

su -c 'psql discourse' postgres

Though there are some obvious differences - the prompt and the exit level - it appears that they are essentially the same.

I would like to know if there are any differences that are not obvious to me. In particular, is one inherently “safer” than the other? Would one trigger / queue jobs and the other not?

4 Likes

I don’t think there’s any difference between the 2 command except that rails db will always work even if/when the db is renamed.

Also it’s shorter, so less typing :wink:

4 Likes