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条)

报告相同问题?

悬赏问题

  • ¥100 需要跳转番茄畅听app的adb命令
  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证