spatie / laravel-backup

A package to backup your Laravel app

Home Page:https://spatie.be/docs/laravel-backup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using "add_extra_option" --tables users not working when I try to dump a specific table from the database.

Don404 opened this issue · comments

This is my config/database code:

'mysql_dump_global_targets' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
            'dump' => [
                'dump_binary_path' => env('MYSQL_DUMP_PATH', ''),
                'use_single_transaction' => true,
                'add_extra_option' => '--tables users'
            ],
        ],

When I try this I am getting:

"Unknown database 'users'" when selecting the database.

When I try to use it like this:

'dump' => [
                'dump_binary_path' => env('MYSQL_DUMP_PATH', ''),
                'use_single_transaction' => true,
                'add_extra_option' => '--tables=users'
            ],

I am getting:

D:/xampp/mysql/bin/mysqldump: option '--tables' cannot take an argument

When I try to use it like this:

'dump' => [
                'dump_binary_path' => env('MYSQL_DUMP_PATH', ''),
                'use_single_transaction' => true,
                'tables' => 'users'
            ],

It is not working.

How to make this work? Is it possible to dump only one table of the database? I am using "spatie/laravel-backup": "^8.2" and Laravel Framework 9.52.16