fixed app starting before db, added creation of contact db
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -34,7 +34,8 @@ services:
|
||||
ports:
|
||||
- ${APP_PORT}:${APP_PORT}
|
||||
depends_on:
|
||||
- db
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user