Updated README for Backend. Renamed skills to fix sql importation.

This commit is contained in:
Yohan Boujon 2023-11-17 09:21:04 +01:00
parent c4a15b1e88
commit 44c8eecd16
2 changed files with 42 additions and 12 deletions

View file

@ -1,32 +1,62 @@
## 📄⚠️ Important note ⚠️📄
Later, an autonomus bash file will be created to make all this config simplier. For now this is the way to go: **manually**.
# Creation of the Database
`[name]` being the username you created in postgres\
`[pwd]` being its password
```
sudo dnf install postgresql postgresql-client postgresql-server postgresql-contrib
sudo -u postgres createdb --owner=name cv
sudo service postgresql restart
### 🐘 Make sure you installed Postgresql 🐘
#### For Fedora
```bash
sudo dnf install postgresql postgresql-server postgresql-contrib
sudo /usr/bin/postgresql-setup --initdb
```
## Importing `.sql` files
### ⚠️ Be sure to modify your config file to access the postgres database ⚠️
Idk for now (xd)
## ⚠️ Be sure to modify your config file to access the postgres database ⚠️
```
```bash
sudo nano /var/lib/pgsql/data/pg_hba.conf
```
Check if those lines are correct :
Then check if those lines are correct:
```
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
```
### _If modified, restart psql service :_
```
sudo service postgresql restart
```
# Env file configuration
### 💻 Create a new user and the database 💻
```sql
sudo -u postgres psql -U postgres
CREATE USER [name] WITH PASSWORD '[pwd]';
CREATE DATABASE cv OWNER [name];
GRANT ALL PRIVILEGES ON DATABASE cv TO [name];
\q
sudo service postgresql restart
```
### ⬆️ Import the sql tables ⬆️
In the `backend` directory you can find a `db` folder which contains all the tables structures for the data base. To import those definitions you can type this command:
```bash
for file in backend/db/*.sql; do
psql -U [name] -d cv -a -f "$file"
done
```
## Env file configuration
Create the `.env` file in this folder root. The file must be composed of the following line:
```
DATABASE_URL=postgres://[name]:[pwd]@localhost/cv