0

I have an error when I create the schema with doctine

$ php bin/console doctrine:schema:create --env=test

In AbstractPostgreSQLDriver.php line 73:

  An exception occurred in driver: SQLSTATE[08006] [7] could not connect to s  
  erver: Connection refused                                                    
    Is the server running on host "127.0.0.1" and accepting                     
    TCP/IP connections on port 5432?      

with my gitlab-ci.yml

database:
  stage: building
  services:
    - postgres:10
  variables:
    POSTGRES_DB: back
    POSTGRES_USER: postgres
    POSTGRES_PASSWORD: ''
    POSTGRES_HOST: postgres
    POSTGRES_PORT: 5432
  before_script:
    # Install pdo_pgsql driver
    - apt-get update
    - apt-get install -y libpq-dev
    - docker-php-ext-install pdo_pgsql
  script:
    - php bin/console doctrine:schema:create --env=test
    - php -d memory_limit=2048M bin/console --env=test cache:warmup --no-debug

And my gitlab-parameters.yml (who is cp on app/config/parameters.yml)

parameters:
    database_host: postgres
    database_port: 5432
    database_name: back
    database_user: postgres
    database_password: ''

Other information :

when I try to create database, I have the good message from gitlab-ci

$ php bin/console doctrine:database:create --env=test
Could not create database "back" for connection named default
An exception occurred while executing 'CREATE DATABASE "back"':

SQLSTATE[42P04]: Duplicate database: 7 ERROR:  database "back" already exists

Version :

php 7.2.19
smyfony 3.4

and my config_text.yml

imports:
    - { resource: config_dev.yml }

framework:
    test: ~
    session:
        storage_id: session.storage.mock_file
    profiler:
        collect: false

web_profiler:
    toolbar: false
    intercept_redirects: false

swiftmailer:
    disable_delivery: true

How fix it?

EDIT :

postgres is not running :

netstat -plntu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      -
2
  • Looks like your parameters.yml has not be read. Tell us your symfony version and post your config-test.yml
    – SilvioQ
    Jul 2, 2019 at 13:23
  • php 7.2.19 smyfony 3.4, and I add the config_test.yml on my post
    – Greg
    Jul 2, 2019 at 14:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.