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');
|
console.log('Tables created successfully');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error creating tables:', err);
|
console.error('Error creating tables:', err);
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- ${APP_PORT}:${APP_PORT}
|
- ${APP_PORT}:${APP_PORT}
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
db-data:
|
db-data:
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="chat-area">
|
<div class="chat-area">
|
||||||
|
<div class="item" draggable="true"></div>
|
||||||
<form id="recipientForm">
|
<form id="recipientForm">
|
||||||
<input id="recipient" autocomplete="off" placeholder="Enter contact"/>
|
<input id="recipient" autocomplete="off" placeholder="Enter contact"/>
|
||||||
<button type="submit">Set contact</button>
|
<button type="submit">Set contact</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user