Why docker-compose down deletes my volume? how to define volume as external?

I’m also facing the same issue, can anyone help please?
my docker-compose.yaml file looks like this: CodePile | Easily Share Piles of Code

version: '3.7'
services:
  app:
    container_name: bsf-quiz-app
    image: sapkotasuren/bsf-quiz
    ports:
      - "443:8443"
    depends_on:
      - postgresqldb
  postgresqldb:
    image: postgres:latest
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=password
      - POSTGRES_USER=postgres
      - POSTGRES_DB=bsfQuiz
      
volumes:
  pgdata:

Does anyone found the solution or have/had the same issue??
I’ve already tried to create the named volume seprately and adding the external value etc in composer file, it doesn’t work for me.