How to Create the Symfony2 Database Schema

Print

Yesterday I tried my hand at setting up the NetworkingInitCms bundle for Symfony2. I decided to start with the sandbox to first learn how it works and then go from there.

I followed the steps in the installation instructions file but soon I hit a road-block.

After I ran the composer install script to ensure that all necessary packages were downloaded and installed and ran and fixed all issues reported by the app/check.php script I noticed that I wasn't able to progress with the installation because the following error was popping up in the dev.log.

  request.CRITICAL: Exception thrown when handling an exception (PDOException: SQLSTATE[42000] [1049] Unknown database 'symfony')

I was using a MySQL database engine so I checked the server to see if a symfony database existed and quickly realized that no there was no such database on the server.

In order to create the database I used the Doctrine create database command, followed by create schema:

    sudo php app/console doctrine:database:create
    sudo php app/console doctrine:schema:create

Once I did that, the database was created and initialized with the correct schema.

Design copyright (c) Miky Dinescu