25 lines
840 B
JavaScript
25 lines
840 B
JavaScript
const { Client } = require('pg');
|
|
|
|
async function check() {
|
|
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();
|
|
const res = await client.query("INSERT INTO geodaten.wea_standorte (projekt_id, wea_nummer, anlagentyp, nabenhoehe, rotordurchmesser, geom) VALUES ($1, $2, $3, $4, $5, ST_Transform(ST_SetSRID(ST_MakePoint($6, $7), 4326), 25832)) RETURNING id",
|
|
['BWSamern-Ohne', 'TEST-2', 'Vestas', 160, 160, 7.3, 52.3]);
|
|
console.log('Inserted ID:', res.rows[0].id);
|
|
} catch (e) {
|
|
console.error(e);
|
|
} finally {
|
|
await client.end();
|
|
}
|
|
}
|
|
check();
|