import 'reflect-metadata' ; import { createConnection } from 'typeorm' ; import { typeOrmConfig } from '../../config' ; import Appointment from '../../models/Appointment' ; import Doctor from '../../models/Doctor' ; import Patient from '../../models/Patient' ; ( async ( ) => { console . log ( 'Beginning dbseed task.' ) ; const conn = await createConnection ( typeOrmConfig ) ; console . log ( 'PG connected.' ) ; let patient = new Patient ( ) ; patient . name = 'Matt' ; const patientRepo = conn . getRepository ( Patient ) ; patient = await patientRepo . save ( patient ) ; console . log ( `Patient saved. id = ${ patient . id }` ) ; await conn . close ( ) ; console . log ( 'PG connection closed.' ) ; console . log ( 'Finished dbseed task.' ) ; } ) ( ) ;