bwsamern-ohne_standortplaner/backend/test_insert_status.js

31 lines
890 B
JavaScript

const { Client } = require('pg');
async function testInsert() {
const client = new Client({
host: '87.106.21.21',
port: 5432,
user: 'enwelo_admin',
password: 'WX1t1cgP1qK09',
database: 'enwelo'
});
try {
await client.connect();
await client.query('BEGIN');
const res = await client.query(
`INSERT INTO geodaten.flaecheneigentuemer_status (id, fsk, projekt_id, status, datum)
VALUES (gen_random_uuid(), '034212009000090003__', '5bb4e049-85f2-4433-b38e-6a66b81e9f06', 'Gesichert', NOW()) RETURNING *`
);
console.log("Insert success:", res.rows[0]);
await client.query('ROLLBACK');
console.log("Rollback success");
} catch (e) {
console.error("Insert failed:", e);
} finally {
await client.end();
}
}
testInsert();