typeorm
typeorm copied to clipboard
TypeORM module save my data in wrong database, is this bug?
I hope my data can save in bot database

And My PostgreSQLConnection.ts:
import {DataSource} from "typeorm";
import DynamicVoiceChannel from "./Entities/Bot/dvcEntity";
const dataSource=new DataSource({
type:"postgres",
host:"localhost",
port:5432,
database:"bot",
username:"postgres",
password:"",
entities:[DynamicVoiceChannel],
synchronize:true
})
export default dataSource
index.ts:
import PostgreConnection from "./PostgreSQLConnection";
import MongoConnection from "./MongoConnection"
import DynamicVoiceChannel from "./Entities/Bot/dvcEntity";
(async () => {
const mongo=await MongoConnection.initialize()
const Postgre=await PostgreConnection.initialize()
const mongoCol=mongo.getMongoRepository(DynamicVoiceChannel);
const datas=await (await mongoCol.find()).map(e => {
delete e._id
return e
})
const PostgreCol=Postgre.getRepository(DynamicVoiceChannel)
for(const d of datas){
await PostgreCol.insert(d);
}
console.log("End")
})()
And it save my data here
So...... is this bug? Or what I forgot to do?
Find a solution? Having the same issue. Always reads/writes from the postgres db even though I explicitly declare the custom.