runtipi/e2e/helpers/db.ts
Nicolas Meienberger 2aeacd7d14 ci: create playwright tests workflow
ci: make db and redis as github action services
2023-06-03 19:18:18 +02:00

20 lines
539 B
TypeScript

import pg from 'pg';
import { getConfig } from '../../src/server/core/TipiConfig';
export const clearDatabase = async () => {
const pgClient = new pg.Client({
user: getConfig().postgresUsername,
host: '127.0.0.1',
database: getConfig().postgresDatabase,
password: getConfig().postgresPassword,
port: getConfig().postgresPort,
});
await pgClient.connect();
// delete all data in table user
await pgClient.query('DELETE FROM "user"');
await pgClient.query('DELETE FROM "app"');
await pgClient.end();
};