dongwusang0314 2018-04-17 00:56
浏览 145
已采纳

Laravel Rollback特定数据库

I try to rollback my database system with php artisan migrate:rollback --database='system'

but it seem the doen't work like the migreation php artisan migrate --database='system

can't you help me found what going on.

here my config/database.php

'connections' => [

    'sqlite' => [
        'driver' => 'sqlite',
        'database' => env('DB_DATABASE', database_path('database.sqlite')),
        'prefix' => '',
    ],

    'mysql' => [
        'driver'    => 'mysql',
        'host'      => env('DB_HOST', 'localhost'),
        'port'      => env('DB_PORT', '4444'),
        'database'  => env('DB_DATABASE', 'forge'),
        'username'  => env('DB_USERNAME', 'forge'),
        'password'  => env('DB_PASSWORD', ''),
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'strict'    => false,
        'engine'    => null,
    ],

    'system' => [
        'driver' => 'mysql',
        'host' => env('SYSTEM_DB_HOST', 'localhost'),
        'port' => env('SYSTEM_DB_PORT', '4444'),
        'database' => env('SYSTEM_DB_DATABASE', 'forge'),
        'username' => env('SYSTEM_DB_USERNAME', 'forge'),
        'password' => env('SYSTEM_DB_PASSWORD', ''),
        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix' => '',
        'strict' => false,
        'engine' => null,
    ],

this is my .env file.

#-----------------------------------------------------
# CLIENT DB CONNECTION
#-----------------------------------------------------
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=databaseNameClient
DB_USERNAME=homestead
DB_PASSWORD=secret

#-----------------------------------------------------
# SYSTEM DB CONNECTION
#-----------------------------------------------------
DB_CONNECTION=system
SYSTEM_DB_HOST=127.0.0.1
SYSTEM_DB_PORT=3306
SYSTEM_DB_DATABASE=databaseNameSystem
SYSTEM_DB_USERNAME=homestead
SYSTEM_DB_PASSWORD=secret

this is the message error i got when i try migration:rollback --database='system' :

[Symfony\Component\Debug\Exception\FatalThrowableError]
  Call to undefined method Illuminate\Database\Schema\MySqlBuilder::dddconnection()

the last lines for my stack trace are:

#23 /vendor/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 {main}  
[2018-04-17 00:51:07] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Database\Schema\MySqlBuilder::dddconnection() in /vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:217
  • 写回答

4条回答 默认 最新

  • dongsimang4036 2018-04-17 12:32
    关注

    Hi thanks your all to take your time to answered my question. I found what going on. In one ove my migration, in the down function I have a function was misspelled

             public function down()
    {
        if (Schema::dddconnection('system')->hasTable('apiservices_categories_translations')) {
            Schema::connection('system')->dropIfExists('apiservices_categories_translations');
        }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥20 R语言单细胞测序 对seurat对象进行标准化时出现问题
  • ¥15 Anaconda navigator updateor一直更新
  • ¥15 请问如何在matlab里使用raven工具?
  • ¥100 关于ios手游充值到一定金额,再点充值提示公众号的问题。
  • ¥15 求一个stm32串口控制程序
  • ¥20 Windows 驱动开发版本疑问相关
  • ¥15 MAC 未能打开磁盘映像
  • ¥15 fastcap使用,二维导体输入问题
  • ¥15 hosts修改后不能访问
  • ¥15 关于化学反应速率C++编译问题/FLUENT