a script was written - but i keep getting this error
import { Dog } from "./dogs/entities/dog.entity";
^^^^^^
SyntaxError: Cannot use import statement outside a module
right now, it should work properly - based on an assumption that you've just created a blank local psg db as a development environment it will push basic dog data/ mock data query for testing purposes. the only problem is the import issue that occur mid compilation
import { Dog } from "./dogs/entities/dog.entity";
import { createConnection } from "typeorm";
export function dbpop(){
createConnection({ //TODO: export to .ENV
*your credentials go here*
],
synchronize: true,
}).then(async connection => {
// here you can start to work with your entities
let dog = new Dog;
dog.name = "test doggie";
dog.birthDate = null;
dog.breed = "a test breed";
dog.socialization = "test";
dog.litterSeparation = "test";
dog.origin = "test";
dog.healthIssues = "none";
dog.foodDrive = "Medium";
dog.preyDrive = "High";
dog.currentSchedule = "none";
dog.energyLevel = "Low";
dog.homeBehaviours = "test";
dog.outsideBehaviours = "test";
dog.customerId = 1;
const dog_1 = await connection.manager
.save(dog);
console.log("dog has been saved", dog_1.id);
}).catch(error => console.log(error));
}
a script was written - but i keep getting this error
right now, it should work properly - based on an assumption that you've just created a blank local psg db as a development environment it will push basic dog data/ mock data query for testing purposes. the only problem is the import issue that occur mid compilation