#23. RoR commands

Remove  master.key and credentials.yml.enc then run following command to regenerate it,

EDITOR="vim --wait" rails credentials:edit

cat /etc/apt/sources.list.d/pgadmin4.list

If you have UFW firewall configured, allow http and https traffic.

sudo ufw allow http

sudo ufw allow https

For taking dump,

psql -U your_user_name -h your_remote_ip -p 5432 -d your_db_name -f Path_for_db_dump_file

bundle exec rake jobs:work

Start queue,

RAILS_ENV=development bin/delayed_job --queues=queue_name1,queue_name2,queue_name3 start​​

Stop queue,

RAILS_ENV=development bin/delayed_job --queues=queue_name1,queue_name2,queue_name3 stop

rvm gemset create your_gemset_name
which rvm
gemset location
/home/{​​​​​​​​{​​​​​​​​user}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​/.rvm/gems
like, 
/home/raj/.rvm/gems
rvm gemset list
rvm use ruby-3.0.0@your_gemset_name
rvm --rvmrc ruby-3.0.0@your_gemset_name
Editor I used - Rubymine/Sublime/VisualCode
rvm gemdir
gem list pg 
gem install pg -v 0.20
gem uninstall pg
pg_config --version
psql --version
RAILS_ENV=development rake db:drop
 rvm install "ruby-3.0.0"
rvm pkg install openssl
rvm reinstall all --force
rvm install "ruby-3.0.0" -j 3
rvm get head
rvm get stable
rvm install "ruby-3.0.0" --with-openssl-dir=$HOME/.rvm/usr - this worked for me.
rvm implode
\curl -sSL https://get.rvm.io | bash
sudo apt-get install libpq-dev
sudo apt autoremove

rake log:clear
rvm use ruby-2.3.1@gemset_name
RAILS_ENV=development rake db:create
psql -U raj -h localhost -p 5433 -d database_name -f Path_of_db_dump_file

rvm gemset create test_gemset
which rvm
rvm gemdir
gem list pg
gem install pg
gem uninstall pg
pg_config --version
psql --version
sudo apt-get --purge remove postgresql postgresql-*
dpkg -l | grep postgres
RAILS_ENV=development rake db:drop
sudo systemctl status postgresql
/etc/apt/sources.list.d/pgdg.list
rvm gemset list
sudo apt autoremove
systemctl status postgresql.service
systemctl status postgresql@12-main.service
systemctl is-enabled postgresql
echo $PS1
source ~/.bashrc

show postgresql constraints -
SELECT conrelid::regclass AS table_name,
       conname AS foreign_key,
       pg_get_constraintdef(oid)
FROM   pg_constraint
WHERE  contype = 'f'
AND    connamespace = 'public'::regnamespace  
ORDER  BY conrelid::regclass::text, contype DESC;


TABLE sample_table (id int, id2 int );
CREATE TABLE sample_table_2 (id int, id2 int, t_id INTEGER REFERENCES sample_table (id));

\d sample_table;
\dt;
 rake db:migrate:status


Comments

Popular posts from this blog

#6. Fetch time in rails

#8. nginx+puma deployment using capistrano