Merge pull request #1 from OlaketalAmigo/h3xplor_branch

H3xplor branch
This commit is contained in:
H3XploR
2026-01-09 04:54:31 +01:00
committed by GitHub
2 changed files with 28 additions and 1 deletions
+17 -1
View File
@@ -1,2 +1,18 @@
# Transcendence
Pog
Exemple d'../.env fonctionnel:
POSTGRES_PASSWORD=coucou
POSTGRES_DB=database
POSTGRES_HOST=database
POSTGRES_USER=user
Gestion de friendship dans POSTGRESQL:
'pending' → demande envoyée
'accepted' → amis
'blocked' → bloqué
'rejected' → refusé
Ressource:
https://www.postgresql.org/docs/
+11
View File
@@ -47,6 +47,17 @@ async function createTables()
content TEXT,
created_at TIMESTAMP DEFAULT NOW()
);
CREATE TABLE IF NOT EXISTS friendship (
id_user1 INT NOT NULL,
id_user2 INT NOT NULL,
status VARCHAR(20) NOT NULL,
created_at TIMESTAMP DEFAULT NOW(),
CHECK (id_user1 < id_user2),
PRIMARY KEY (id_user1, id_user2),
FOREIGN KEY (id_user1) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (id_user2) REFERENCES users(id) ON DELETE CASCADE
);
`);
console.log('Tables created!');
}