Umbau auf postgres 2. step
This commit is contained in:
@@ -3,7 +3,7 @@ const { Pool } = pkg;
|
||||
import fsextra from 'fs-extra';
|
||||
const { fstat, readFileSync, writeJsonSync } = fsextra;
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { CommercialPropertyListing, User } from '../common-models/src/main.model';
|
||||
|
||||
// PostgreSQL Verbindungskonfiguration
|
||||
const pool = new Pool({
|
||||
user: 'bizmatch',
|
||||
@@ -70,7 +70,7 @@ async function importBusinesses() {
|
||||
async function importUser() {
|
||||
const filePath = './data/broker.json'
|
||||
const data: string = readFileSync(filePath, 'utf8');
|
||||
const jsonData: User[] = JSON.parse(data); // Erwartet ein Array von Objekten
|
||||
const jsonData: any[] = JSON.parse(data); // Erwartet ein Array von Objekten
|
||||
await pool.query('drop table if exists users');
|
||||
await pool.query(`CREATE TABLE users (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
@@ -96,7 +96,7 @@ async function importUser() {
|
||||
async function importCommercials() {
|
||||
const filePath = './data/commercials.json'
|
||||
const data: string = readFileSync(filePath, 'utf8');
|
||||
const jsonData: CommercialPropertyListing[]|any = JSON.parse(data); // Erwartet ein Array von Objekten
|
||||
const jsonData: any[]|any = JSON.parse(data); // Erwartet ein Array von Objekten
|
||||
await pool.query('drop table if exists commercials');
|
||||
await pool.query(`CREATE TABLE commercials (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
|
||||
Reference in New Issue
Block a user