Skip to content

Commit

Permalink
Merge pull request #174 from TogetherCrew/add-delete-db-method
Browse files Browse the repository at this point in the history
feat: add delete db method
  • Loading branch information
Behzad-rabiei authored Aug 5, 2024
2 parents 5477322 + 124f423 commit a3f2b03
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 a3f2b03

Please sign in to comment.