Skip to content

Commit

Permalink
feat: add delete db method
Browse files Browse the repository at this point in the history
  • Loading branch information
Behzad-rabiei committed Aug 5, 2024
1 parent 8fa8b18 commit 124f423
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@togethercrew.dev/db",
"version": "3.0.63",
"version": "3.0.64",
"description": "All interactions with DB",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -55,4 +55,4 @@
"files": [
"dist/**/*"
]
}
}
10 changes: 10 additions & 0 deletions src/service/databaseManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,14 @@ export default class DatabaseManager {
}
}
}

// Method to delete a database using the connection
public async deleteDatabase(db: Connection): Promise<void> {
const dbName = db.name;
try {
await db.dropDatabase();
} catch (error) {
console.error(`Error deleting database ${dbName}:`, error);
}
}
}

0 comments on commit 124f423

Please sign in to comment.