const { Client } = require('pg');

async function clean() {
    require('dotenv').config({ path: '../.env' });
const client = new Client({
    host: process.env.DB_HOST,
    port: process.env.DB_PORT,
    user: process.env.DB_USER,
    password: process.env.DB_PASSWORD,
    database: process.env.DB_NAME
});
    
    try {
        await client.connect();
        console.log("Cleaning up test entries...");
        const res = await client.query("DELETE FROM geodaten.wea_standorte WHERE projekt_id LIKE '%Test%' OR wea_nummer = 'TEST-1'");
        console.log(`Cleaned ${res.rowCount} rows.`);
    } catch (e) {
        console.error("Error:", e);
    } finally {
        await client.end();
    }
}
clean();
