Different CLI commands to get to the database

(Mittineague) #1

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


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?

(Régis Hanol) #2

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: