This post describes a quick setup which allows one to develop a postgres sql backed application locally. (This is taken from thiseggheadio video.)
Create adocker-compose.yml
file as follows.
version: "3.8"services: db: image: "postgres:12" ports: - "54320:5432" volumes: - ./pgdata:/var/lib/postgresql/data environment: - POSTGRES_USER=alice - POSTGRES_PASSWORD=wonderland - POSTGRES_DB=myawesomedb
Create a local folder which will persist data and start the service.
mkdir pgdatadocker-compose up -d
Once it is up and running, verify you can log into postgres shell.
docker-compose run db bash
Inside the docker container run the following and enter passwordwonderland
defined above.
psql --host=db --username=alice --dbname=myawesomedb
You should see psql shell. You can exit by pressing Ctrl+D twice.
At this point most likely you already haveprisma
setup locally by some variation of the following commands.
npx prisma initnpx prisma generate
Now you can run the following command to create andapply migrations.
npx prisma migrate dev --name init
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse