apiVersion: batch/v1
kind: Job
metadata:
  name: $CI_NAME-migration
spec:
  backoffLimit: 0
  template:
    spec:
      containers:
        - name: $CI_NAME-migration
          image: $IMAGE_TAG
          env:
            - name: NODE_ENV
              value: 'production'
            - name: POSTGRES_USER
              valueFrom:
                secretKeyRef:
                  name: jupiter-postgres-secret
                  key: username
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: jupiter-postgres-secret
                  key: password
            - name: POSTGRES_SCHEMA
              valueFrom:
                secretKeyRef:
                  name: jupiter-postgres-secret
                  key: database
            - name: POSTGRES_HOST
              valueFrom:
                secretKeyRef:
                  name: jupiter-postgres-secret
                  key: host
            - name: POSTGRES_PORT
              valueFrom:
                secretKeyRef:
                  name: jupiter-postgres-secret
                  key: port
      restartPolicy: Never
