dw-postgresql
v1.2.4
Published
Projeto destinado a config de conexao ao banco de dados
Downloads
5
Readme
dw-postgresql
Começando
npm install dw-postgresql
Crie um arquivo .env e adicione as seguintes variaveis
DATABASE_URL
SHADOW_DATABASE_URL
Ambas as váriaveis devem conter a uri de conexão com o banco de dados
A váriavel database_url deve ser preenchida com a uri de conexão com o banco de dados principal
A váriavel shadow_database_url deve ser preenchida com a uri de conexão com o banco de dados sombra, que é uma réplica do banco principal
Configurando
No diretório /src do projeto é necessário criar uma pasta "database" com o arquivo prismaClient.ts(database/prismaClient.ts) com o seguinte conteúdo:
import { prisma } from "dw-postgresql";
export { prisma }
E pronto, agora é só usar o prisma dentro do projeto