dizda / CloudBackupBundle

Be able to backup your database(s) and upload it to the cloud (Dropbox, Amazon S3, GoogleDrive, etc.)
MIT License
196 stars 57 forks source link

Add an option to ignore tables #79

Closed lakhman closed 8 years ago

lakhman commented 8 years ago

Awesome lib, would be really useful to ignore tables from the dump (can be provided via config). I found a hacky solution like so:

# database/MySQL.php

    protected function getCommand()
    {
        return sprintf('mysqldump %s %s %s > %s',
            $this->auth,
            $this->database,
            '--ignore-table=database.table', // Add this (optional, if empty/blank then is ignored)
            $this->dataPath.$this->fileName);
    }

I have a database which is quite large, I only want to backup the important tables (some of the other crap is useful to have - but not required for backup (it's a temporary holding table)).

Perhaps just have a config reference named "ignore tables" which holds an array of tables to ignore.

also, could we have an option to name the outputted (copied) tar file (instead of using the computer name - "Macbook Pro" - on my pc), or even name the first part the name of the databases exported? (database_name-2015-10-22-10-30-20.tar) - rather than (Macbook-Pro-2015-10-22-10-30-20.tar)

http://stackoverflow.com/questions/425158/skip-certain-tables-with-mysqldump

Thanks!

dizda commented 8 years ago

Hello,

Thanks for the feedback, your feature suggestion is indeed a good idea, could you provide a PR for that?

About the file name, it's already possible to customize it, check it out here https://github.com/dizda/CloudBackupBundle#configuration output_file_prefix field in the configuration file.