Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.32 KB

README.md

File metadata and controls

46 lines (34 loc) · 1.32 KB

Setup-Diesel-with-PostgreSQL

DB EXPERIENCE WITH RUST DIESEL POSTGRESQL AND WITHOUT FEAR OF SUCCESS

Installation of PostgreSQL

  • sudo pacman -Syu postgresql

Installation of diesel

Installation of rust

ProgreSQL Setup

  • Open as postgres user
  • sudo -iu postgres
  • Initializing the database of regional and specify dirs to save db datas in this case /var/lib/..
  • initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'
  • exit

Startup the service

  • Starting postgres service
  • sudo systemctl start postgresql
  • Setup to running when the os is initializing
  • sudo systemctl enable postgresql

Get access on PostgreSQL and make the DB

  • sudo -iu postgres
  • psql
  • Make a database and user
  • CREATE DATABASE my_own_db;
  • CREATE USER diesel_user WITH PASSWORD 'default';
  • GRANT ALL PRIVILEGES ON DATABASE my_own_db;
  • (!) Important step, you need specify that you are also the owner of the db in addition to having the permissions.
  • ALTER DATABASE my_own_db OWNER TO diesel_user;
  • \q
  • exit

Inicializar Diesel and make a table

  • Set enviroment vars on files
  • echo "DATABASE_URL=postgres://diesel_user:default@localhost/my_own_db" >> .env
  • diesel setup