mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
fixed all issues regarding team's member list page where users couldn't leave properly or where they couldn't join properly. the team selection page will now directly communicate with the database to ensure everything stays up to date. The team member list page will also auto update every few seconds so the user will not have to manually update their page.
This commit is contained in:
1 parent
10c117e223
commit
673ea41a4c
11 files changed
+373
-36
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { run } from "./db.js";
|
||||
|
||||
async function updateDatabaseSchema() {
|
||||
try {
|
||||
console.log("Checking and updating database schema...");
|
||||
|
||||
// Check if last_updated column exists in teams table
|
||||
try {
|
||||
// Add last_updated column to teams table if it doesn't exist
|
||||
// SQLite syntax for adding columns if they don't exist
|
||||
await run(`
|
||||
ALTER TABLE teams ADD COLUMN last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP;
|
||||
`);
|
||||
console.log("Added last_updated column to teams table");
|
||||
} catch (error) {
|
||||
// If error contains "duplicate column name" then the column already exists
|
||||
if (!error.message.includes("duplicate column name")) {
|
||||
throw error; // Re-throw if it's a different error
|
||||
}
|
||||
console.log("last_updated column already exists in teams table");
|
||||
}
|
||||
|
||||
console.log("Database schema update completed successfully");
|
||||
} catch (error) {
|
||||
console.error("Database schema update error:", error);
|
||||
}
|
||||
}
|
||||
|
||||
// Run the update
|
||||
updateDatabaseSchema();
|
||||
|
||||
// Export for potential use in other modules
|
||||
export default updateDatabaseSchema;
|
||||
Reference in new issue
Block a user