feat: add MariaDB schema and connection pool
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import mariadb from 'mariadb';
|
||||
|
||||
let pool;
|
||||
|
||||
export function getPool(config) {
|
||||
if (!pool) {
|
||||
pool = mariadb.createPool({
|
||||
host: config.db.host,
|
||||
user: config.db.user,
|
||||
password: config.db.password,
|
||||
database: config.db.database,
|
||||
connectionLimit: 10,
|
||||
});
|
||||
}
|
||||
return pool;
|
||||
}
|
||||
|
||||
export async function closePool() {
|
||||
if (pool) {
|
||||
await pool.end();
|
||||
pool = undefined;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user