- PHP 8.1
- Symfony client https://symfony.com/downloads
- Postgresql
- Npm
- Install Psql
- Connect to postgres
psql - Create a db, user, and grant privileges
CREATE USER mpb WITH PASSWORD 'mpb';
CREATE DATABASE mpb_db;
GRANT ALL PRIVILEGES ON DATABASE "mpb_db" to mpb;
- Run migrations
symfony console doctrine:migrations:migratesymfony composer install
symfony console assets:install
symfony servenpm install
npm run dev - Create test database
CREATE DATABASE mpb_db_test;
GRANT ALL PRIVILEGES ON DATABASE "mpb_db_test" TO mpb;
- Load fixtures
symfony console doctrine:migrations:migrate --env=test
symfony console doctrine:fixtures:load --env=test- Use phpunit to run tests
php ./vendor/bin/simple-phpunit tests
# Or using makefile
make testphp ./vendor/bin/dep deploy
# Or using Make
make deployWe use php-cs-fixer, rector, and phpstan
php ./vendor/bin/rector process
php ./vendor/bin/phpstan analyse
php ./vendor/bin/php-cs-fixer fix src --allow-risky=yes
php ./vendor/bin/php-cs-fixer fix tests --allow-risky=yes
# Or using Make
make rector
make stan
make lint
# Or running all at once
make cs1. SQLSTATE[42501]: Insufficient privilege: 7 ERROR: permission denied for schema public
This issue often occurs during Doctrine migrations or when importing a SQL dump.
It means that the user configured in .env doesn't have sufficient privileges on the public schema.
Solution :
-
Connect to the database :
psql -U <user> -d <database>
-
Execute the following commands :
GRANT ALL ON SCHEMA public TO mpb; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO mpb;
-
Rerun the migration :
symfony console doctrine:migrations:migrate