Sylius: Sample data installation fails in 1.1.0

Created on 11 Feb 2018  ยท  8Comments  ยท  Source: Sylius/Sylius

| Q | A
| ---------------- | -----
| Bug report? | yes
| Feature request? | no
| BC Break report? | no
| RFC? | no
| Sylius version | 1.1.0

sylius:install fails at sample data with an SQL exception in 1.1.0, but it works in 1.0.9. Installed with composer create-project sylius/sylius-standard sylius and sylius:install

Output below:

$ php7.1 bin/console sylius:install
Installing Sylius...

           ,                                                       
         ,;:,                                                      
       `;;;.:`                                                     
      `::;`  :`                                                    
       :::`   `          .'++:           ''.   '.                  
       `:::             :+',;+'          :+;  `+.                  
        ::::            +'   :'          `+;                       
        `:::,           '+`     ++    :+.`+; `++. ;+'    ''  ,++++.
         ,:::`          `++'.   .+:  `+' `+;  .+,  ;+    +'  +;  ''
          ::::`           ,+++.  '+` :+. `+;  `+,  ;+    +'  '+.   
   ,.     .::::             .++` `+: +'  `+;  `+,  ;+    +'  `;++; 
`;;.:::`   :::::             :+.  '+,+.  `+;  `+,  ;+   `+'     .++
 .;;;;;;::`.::::,       +'` `++   `++'   `+;  `+:  :+. `++'  '.  ;+
  ,;;;;;;;;;:::::       .+++++`    ;+,    ++;  ++, `'+++,'+' :++++,
   ,;;;;;;;;;:::`                  ;'                              
    :;;;;;;;;;:,                :.:+,                              
     ;;;;;;;;;:                 ;++,

Step 1 of 4. Checking system requirements.
------------------------------------------

Success! Your system can run Sylius properly.

Step 2 of 4. Setting up the database.
-------------------------------------

Creating Sylius database for environment dev.
 2/2 [โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 100%

Loading sample data for environment dev.
Warning! This action will erase your database.
Continue? (y/N) y
Created "/home/j/localhost/sylius/web/media" directory.
Created "/home/j/localhost/sylius/web/media/image" directory.
 0/1 [โ–‘                           ]   0%
In AbstractMySQLDriver.php line 75:

  An exception occurred while executing 'INSERT INTO sylius_order_item (quant  
  ity, unit_price, units_total, adjustments_total, total, is_immutable, order  
  _id, product_name, variant_name, variant_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?  
  , ?, ?)' with params [2, 569, 1138, 0, 1138, 0, 1, "Book \"officiis\" by El  
  iza Zboncak DDS", "quo", 104]:                                               

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_name' in 'f  
  ield list'                                                                   


In PDOStatement.php line 107:

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_name' in 'f  
  ield list'                                                                   


In PDOStatement.php line 105:

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_name' in 'f  
  ield list'                                                                   


sylius:fixtures:load [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<suite>]
Critical Potential Bug

Most helpful comment

I think we should consider covering installation process with tests. Unfortunately it's not the first time something is wrong with the installation process and actually having a nice Behat scenario would also be helpful for new developers to see what's happening under the hood during installation.

All 8 comments

Could you try to run database migrations first - bin/console doctrine:migrations:migrate?

Before install: Exception because the database doesn't exist.

After (failed) install: "No migrations to execute".

Output below

$ php7.1 bin/console doctrine:migrations:migrate

                    Sylius Migrations                    



In AbstractMySQLDriver.php line 108:

  An exception occurred in driver: SQLSTATE[HY000] [1049] Unknown database 's  
  ylius'                                                                       


In PDOConnection.php line 47:

  SQLSTATE[HY000] [1049] Unknown database 'sylius'  


In PDOConnection.php line 43:

  SQLSTATE[HY000] [1049] Unknown database 'sylius'  


doctrine:migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--configuration [CONFIGURATION]] [--db-configuration [DB-CONFIGURATION]] [--db DB] [--em EM] [--shard SHARD] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<version>]

$ php7.1 bin/console sylius:install
Installing Sylius...

           ,                                                       
         ,;:,                                                      
       `;;;.:`                                                     
      `::;`  :`                                                    
       :::`   `          .'++:           ''.   '.                  
       `:::             :+',;+'          :+;  `+.                  
        ::::            +'   :'          `+;                       
        `:::,           '+`     ++    :+.`+; `++. ;+'    ''  ,++++.
         ,:::`          `++'.   .+:  `+' `+;  .+,  ;+    +'  +;  ''
          ::::`           ,+++.  '+` :+. `+;  `+,  ;+    +'  '+.   
   ,.     .::::             .++` `+: +'  `+;  `+,  ;+    +'  `;++; 
`;;.:::`   :::::             :+.  '+,+.  `+;  `+,  ;+   `+'     .++
 .;;;;;;::`.::::,       +'` `++   `++'   `+;  `+:  :+. `++'  '.  ;+
  ,;;;;;;;;;:::::       .+++++`    ;+,    ++;  ++, `'+++,'+' :++++,
   ,;;;;;;;;;:::`                  ;'                              
    :;;;;;;;;;:,                :.:+,                              
     ;;;;;;;;;:                 ;++,

Step 1 of 4. Checking system requirements.
------------------------------------------

Success! Your system can run Sylius properly.

Step 2 of 4. Setting up the database.
-------------------------------------

Creating Sylius database for environment dev.
 2/2 [โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 100%

Loading sample data for environment dev.
Warning! This action will erase your database.
Continue? (y/N) y
Created "/home/j/localhost/sylius/web/media" directory.
Created "/home/j/localhost/sylius/web/media/image" directory.
 0/1 [โ–‘                           ]   0%
In AbstractMySQLDriver.php line 75:

  An exception occurred while executing 'INSERT INTO sylius_order_item (quant  
  ity, unit_price, units_total, adjustments_total, total, is_immutable, order  
  _id, product_name, variant_name, variant_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?  
  , ?, ?)' with params [2, 442, 884, 0, 884, 0, 1, "Mug \"blanditiis\"", "omn  
  is", 16]:                                                                    

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_name' in 'f  
  ield list'                                                                   


In PDOStatement.php line 107:

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_name' in 'f  
  ield list'                                                                   


In PDOStatement.php line 105:

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_name' in 'f  
  ield list'                                                                   


sylius:fixtures:load [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<suite>]

$ php7.1 bin/console doctrine:migrations:migrate

                    Sylius Migrations                    


No migrations to execute.

(But I suspect migrations are/should be done by sylius:install anyway)

Ah okay, looks like migrations are missing in Sylius/Sylius-Standard and they're present in Sylius/Sylius, I'll let you know as soon as I fix that :)

Thanks! Glad to know it's not just me :)

Creating a project based on Sylius-Standard again should help ๐ŸŽ‰

I think we should consider covering installation process with tests. Unfortunately it's not the first time something is wrong with the installation process and actually having a nice Behat scenario would also be helpful for new developers to see what's happening under the hood during installation.

That did the trick! Though I agree with @bitbager - the full install process should be tested both for breaks and to ensure the instructions on the website are up to date

@pamil: Is there a way to fix this with existing projects?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

crbelaus picture crbelaus  ยท  3Comments

loic425 picture loic425  ยท  3Comments

stefandoorn picture stefandoorn  ยท  3Comments

xleliberty picture xleliberty  ยท  3Comments

inssein picture inssein  ยท  3Comments