sudo apt install postgresql postgresql-contrib
sudo systemctl enable postgresql
sudo systemctl start postgresql
sudo systemctl status postgresql
sudo apt install dbeaver-ce
sudo nano /etc/postgresql/14/main/pg_hba.conf
Look for the following line:
host all all 127.0.0.1/32 md5
sudo nano /etc/postgresql/14/main/postgresql.conf
Ensure that listen_addresses is set to '*' to allow connections from any IP
sudo systemctl restart postgresql
sudo -i -u postgres
psql
CREATE USER value_flows WITH PASSWORD 'valueflows';
CREATE DATABASE vf5;
GRANT ALL PRIVILEGES ON DATABASE vf5 TO value_flows;
\du
\q
exit
cargo install diesel_cli --no-default-features --features postgres
DATABASE_URL=postgres://your_user_name:your_password@localhost/your_database_name
diesel setup
diesel migration generate
Copy the content of table into up.sql
diesel migration run
cargo run
diesel print-schema > src/db/schema.rs