yiisoft / db-migration

The package implementing migration for yiisoft/db.
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
29 stars 16 forks source link

Error: Class 'yii\db\pgsql\Schema' not found Connection.php #22

Closed terabytesoftw closed 4 years ago

terabytesoftw commented 5 years ago

What steps will reproduce the problem?

vendor/bin/yii migrate

What is the expected result?

Migration tables

Additional info

A few days ago it worked perfect, I only use mysql, I do not understand why it asks for the pgsql driver.

Q A
Yii version 3.0
PHP version 7.2.23
Operating system Centos 7
machour commented 5 years ago

Is Connection.php the one in this repository? The line number seems weird: https://github.com/yiisoft/db/blob/master/src/Connection.php#L823

Can you run composer update to make sure you're on the latests versions?

yii-bot commented 5 years ago

Thanks for posting in our issue tracker. In order to properly assist you, we need additional information:

Thanks!

This is an automated comment, triggered by adding the label status:need more info.

terabytesoftw commented 5 years ago

Of course, you can try it without having any migration give the error.

composer show

yiisoft/active-record              dev-master 0fdc73d Yii ActiveRecord Library
yiisoft/cache                      dev-master f9aa30c Yii Caching Library                                                                                                                                   
yiisoft/db                         dev-master e93aa75 Yii DataBase Library                                                                                                                                  
yiisoft/db-mysql                   dev-master 4a71bdf Yii DataBase MySQL Extension                                                                                                                          
yiisoft/di                         dev-master ea2196e Yii DI container                                                                                                                                      
yiisoft/log                        dev-master 30d24a5 Yii Logging Library                                                                                                                                   
yiisoft/rbac                       dev-master f248a22 Yii Role-Based Access Control Library                                                                                                                 
yiisoft/view                       dev-master 58a2fa1 Yii View Rendering Library                                                                                                                            
yiisoft/yii-bootstrap4             dev-master 6067cd7 Yii Framework Twitter Bootstrap 4 Extension                                                                                                           
yiisoft/yii-captcha                dev-master 0adcf8e Yii Framework CAPTCHA Extension                                                                                                                       
yiisoft/yii-console                dev-master 93170cb Yii Framework Console Extension                                                                                                                       
yiisoft/yii-core                   dev-master ad5a548 Yii Framework Core                                                                                                                                    
yiisoft/yii-dataview               dev-master cb6dca6 Yii Framework Data Displaying Extension                                                                                                               
yiisoft/yii-debug                  dev-master f270096 Yii Framework Debug Panel Extension                                                                                                                   
yiisoft/yii-jquery                 dev-master 94fcabb Yii Framework jQuery Extension                                                                                                                        
yiisoft/yii-swiftmailer            dev-master 539fe59 Yii Framework Swift Mailer Extension                                                                                                                  
yiisoft/yii-web                    dev-master 7001826 Yii Framework Web Extension
$ vendor/bin/yii migrate                                                                                                                                                                                    
Yii Migration Tool (based on Yii v3.0.0-dev)                                                                                                                                                                                                                                                                                                                                                                            
Error: Class 'yii\db\pgsql\Schema' not found
--
terabytesoftw commented 5 years ago

The problem lies in the config/common.php, of db, if I configure it directly without parameters it works perfect.

    'db' => [
        '__class'   => \yii\db\Connection::class,
        'dsn'       => 'pgsql:dbname=' . $params['db.name']
                        . (!empty($params['db.host']) ? (';host=' . $params['db.host']) : '')
                        . (!empty($params['db.port']) ? (';port=' . $params['db.port']) : ''),
        'username'  => $params['db.user'],
        'password'  => $params['db.password'],
    ],
machour commented 5 years ago

cc @hiqsol any reasons why this was decided as default configuration?

I think we should either ship no configuration beside __class, or have another param like db.type (or db.dsn with the whole connection string)