alechko
03/22/2022, 6:52 AMprisma migrate command generates raw sql file and there’s no up method that could be used to launch a custom script or whatever to initiate a data migration process related to the schema process. is there a best practices how to do that with maybe prisma seed or some other method, or do I need to figure out on my own how to do that?
2. are UNION queries available from the client api or only by raw sql?
3. is there a way to specify db master/replicas and set the query to use a replica for reads and master for writes? (like Mikro-ORM)
Thanks!Nurul
03/22/2022, 8:47 AMmigrate diff and db execute commands which were introduced recently and are in preview.
2. As of now, Raw SQL would be the only way but we do have an existing Feature Request to support Union Query and Union Type
3. You can dynamically pass a connection string when instantiating a PrismaClient so you can have two clients in your app, one for reads and one for writes. Reference - Programmatically override datasource url
const readClient = new PrismaClient({
datasources: { db: { url: "xx-read-connection-string-xx" }}
})
const writeClient = new PrismaClient({
datasources: { db: { url: "xx-write-connection-string" }}
})alechko
03/22/2022, 8:57 AMjanpio