fixed app starting before db, added creation of contact db

This commit is contained in:
slawk0
2024-09-18 20:48:18 +02:00
parent 2f395051d1
commit 88904fcb53
3 changed files with 12 additions and 1 deletions

View File

@@ -43,6 +43,15 @@ async function createTables() {
)
`);
// Create contacts table
await db.query(`
CREATE TABLE IF NOT EXISTS contacts (
username TEXT NOT NULL,
contact TEXT NOT NULL,
status TEXT NOT NULL
)
`);
console.log('Tables created successfully');
} catch (err) {
console.error('Error creating tables:', err);

View File

@@ -34,7 +34,8 @@ services:
ports:
- ${APP_PORT}:${APP_PORT}
depends_on:
- db
db:
condition: service_healthy
volumes:
db-data:

View File

@@ -18,6 +18,7 @@
</div>
<div class="chat-area">
<div class="item" draggable="true"></div>
<form id="recipientForm">
<input id="recipient" autocomplete="off" placeholder="Enter contact"/>
<button type="submit">Set contact</button>