1

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
Racine Pilote
  • 43
  • 2
  • 10

4 Answers4

0

You have accidently changed the methods in vendor folder.

Step 1.

delete the vendor folder.

Step 2.

run

composer install

It will install all the libraries again and overwrite changes.

Hope this helps

FULL STACK DEV
  • 15,207
  • 5
  • 46
  • 66
0

It's quite difficult to say without looking at full error log, but there is alternate for this, if you create down methods for your migration by providing specific database connection like this

Schema::connection('mysql2')->create('some_table', function($table)
{
$table->increments('id'):
});

Then only php artisan migrate:rollback will work perfectly for this.

dvl333
  • 183
  • 1
  • 12
0
If you look in your migrations table, then you’ll see each migration 
 has a batch number. So when you roll back, it rolls back each 
 migration that was part of the last batch.

If you only want to roll back the very last migration, then just 
increment the batch number by one. Then next time you run the rollback 
    command, it’ll only roll back that one migration as it’s in a “batch” of 
 its own.

for more follow the url : Rollback one specific migration in Laravel

Kuldeep Mishra
  • 3,846
  • 1
  • 21
  • 26
0

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');
    }
}
Racine Pilote
  • 43
  • 2
  • 10