| 31 | } |
| 32 | |
| 33 | export async function tearDownMysql(connectionString: string) { |
| 34 | const credentials = uriToCredentials(connectionString) |
| 35 | |
| 36 | const credentialsClone = { ...credentials } |
| 37 | credentialsClone.database = 'mysql' |
| 38 | |
| 39 | const db = await mariadb.createConnection({ |
| 40 | host: credentialsClone.host, |
| 41 | port: credentialsClone.port, |
| 42 | database: credentialsClone.database, |
| 43 | user: credentialsClone.user, |
| 44 | password: credentialsClone.password, |
| 45 | multipleStatements: true, |
| 46 | allowPublicKeyRetrieval: true, |
| 47 | }) |
| 48 | |
| 49 | await db.query(` |
| 50 | DROP DATABASE IF EXISTS \`${credentials.database}\`; |
| 51 | `) |
| 52 | await db.end() |
| 53 | } |