{"id":19664599,"url":"https://github.com/sourcebroker/deployer-extended-database","last_synced_at":"2025-04-04T18:06:33.621Z","repository":{"id":37492985,"uuid":"94528993","full_name":"sourcebroker/deployer-extended-database","owner":"sourcebroker","description":"Deployer tasks to manage database synchronization between application instances.","archived":false,"fork":false,"pushed_at":"2025-03-05T18:57:38.000Z","size":408,"stargazers_count":40,"open_issues_count":2,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T17:08:00.791Z","etag":null,"topics":["database","deployer","deployments","php","sb-ded","synchronization"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sourcebroker.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-16T09:33:36.000Z","updated_at":"2025-03-05T18:57:41.000Z","dependencies_parsed_at":"2025-03-21T16:20:15.068Z","dependency_job_id":null,"html_url":"https://github.com/sourcebroker/deployer-extended-database","commit_stats":{"total_commits":238,"total_committers":4,"mean_commits":59.5,"dds":"0.037815126050420145","last_synced_commit":"4b11030e32c2892518403cbfc74f4e36a1ff7101"},"previous_names":[],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sourcebroker","download_url":"https://codeload.github.com/sourcebroker/deployer-extended-database/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226213,"owners_count":20904465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","deployer","deployments","php","sb-ded","synchronization"],"created_at":"2024-11-11T16:18:18.381Z","updated_at":"2025-04-04T18:06:33.603Z","avatar_url":"https://github.com/sourcebroker.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"deployer-extended-database\n==========================\n\n.. image:: https://poser.pugx.org/sourcebroker/deployer-extended-database/v/stable\n   :target: https://packagist.org/packages/sourcebroker/deployer-extended-database\n\n.. image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat\n   :target: https://packagist.org/packages/sourcebroker/deployer-extended-database\n\n|\n\n.. contents:: :local:\n\nWhat does it do?\n----------------\n\nThe package provides additional tasks for deployer (deployer.org) for synchronizing databases between instances.\nMost useful are tasks:\n\n1. task \"`db:pull`_ [source-instance]\" task which allows you to pull database from remote instance to local instance,\n\n2. task \"`db:push`_ [target-instance]\" task which allows you to push database from local to remote instance,\n\n2. task \"`db:copy`_ [source-instance] --options=target:[target-instance]\" which allows to copy database between remote instances.\n\nInstallation\n------------\n\n1) Install package with composer:\n   ::\n\n      composer require sourcebroker/deployer-extended-database\n\n\n2) Put following lines in your deploy.php:\n   ::\n\n      require_once(__DIR__ . '/vendor/autoload.php');\n      new \\SourceBroker\\DeployerLoader\\Load([\n          ['path' =\u003e 'vendor/sourcebroker/deployer-instance/deployer'],\n          ['path' =\u003e 'vendor/sourcebroker/deployer-extended-database/deployer'],\n      ]);\n\n\n4) Create \".env\" file in your project root (where you store deploy.php file). The .env file should be out of\n   git because you need to store here information about instance name. Additionally put there info about database\n   you want to synchronise. You can move the info about database data to other file later but for the tests its better\n   to put it in .env file. Remember to protect .env file from downloading with https request (if the root folder\n   is readable from WWW server level).\n   ::\n\n      INSTANCE=\"local\"\n\n      DATABASE_HOST=\"127.0.0.1\"\n      DATABASE_NAME=\"database_name\"\n      DATABASE_USER=\"database_user\"\n      DATABASE_PASSWORD=\"password\"\n\n   The INSTANCE must correspond to ``host()`` name. You need to put the .env file with proper INSTANCE name and\n   database access data on on each of you instances.\n\n5) Define \"local\" localhost and set the \"db_databases\" for it. Use following code:\n   ::\n\n      (new \\SourceBroker\\DeployerExtendedDatabase\\Driver\\EnvDriver())-\u003egetDatabaseConfig()\n\n   which will read database data from .env file.\n   ::\n\n      localhost('local')\n          -\u003eset('deploy_path', getcwd())\n          -\u003eset('bin/php', 'php')\n          -\u003eset('db_databases', [\n              'database_default' =\u003e [\n                  (new \\SourceBroker\\DeployerExtendedDatabase\\Driver\\EnvDriver())-\u003egetDatabaseConfig()\n              ]\n          ])\n\n6) Add \"db_databases\" var for all other hosts. For example for live host it can be:\n   ::\n\n      host('live')\n          -\u003esetHostname('my-server.example.com')\n          -\u003esetRemoteUser('deploy')\n          -\u003eset('bin/php', '/usr/bin/php82')\n          -\u003eset('deploy_path', '/var/www/myapplication/')\n          -\u003eset('db_databases', [\n              'database_default' =\u003e [\n                  (new \\SourceBroker\\DeployerExtendedDatabase\\Driver\\EnvDriver())-\u003egetDatabaseConfig()\n              ]\n          ])\n\n7) Make sure all instances have the same ``/vendors`` folder with ``deployer-extended-database`` and the same ``deploy.php`` file.\n   Most problems are because of differences in ``deploy.php`` file between instances.\n\n8) Run ``dep db:pull live`` to test if all works.\n\nOptions\n-------\n\n- | **db_databases**\n  | *default value:* null\n  |\n  | Databases to be synchronized. You can define more than one database to be synchronized. See `db_databases`_ for\n    options available inside db_databases. Look for `Examples`_ for better understanding of structure.\n\n  |\n- | **db_storage_path_relative**\n  | *default value:* .dep/database/dumps\n  |\n  | Path relative to \"deploy_path\" where you want to store database dumps produced during database synchro commands.\n\n  |\n- | **db_export_mysqldump_options_structure**\n  | *default value:* --no-data=true --default-character-set=utf8mb4 --no-tablespaces\n  |\n  | Options `mysqldump` used for exporting the database structure.\n\n  |\n- | **db_export_mysqldump_options_data**\n  | *default value:* --opt --skip-lock-tables --single-transaction --no-create-db --default-character-set=utf8mb4 --no-tablespaces\n  |\n  | Options `mysqldump` used for exporting the database data.\n\n  |\n- | **db_import_mysql_options_structure**\n  | *default value:* --default-character-set=utf8mb4\n  |\n  | Options `mysql` used for importing the database structure.\n\n  |\n- | **db_import_mysql_options_data**\n  | *default value:* --default-character-set=utf8mb4\n  |\n  | Options `mysql` used for importing the database data.\n\n  |\n- | **db_import_mysql_options_post_sql_in**\n  | *default value:* --default-character-set=utf8mb4\n  |\n  | Options `mysql` used for importing the additional SQL from ``post_sql_in``.\n\n\nNOTE: watch that ``utf8mb4`` is forced for all mysql/mysqldump operations.\n\n\n.. _db\\_databases:\n\nOptions for \"db_databases\"\n--------------------------\n\n\"db_databases\" is an array of \"database configurations\" and \"database configuration\" is array of configuration parts.\nConfiguration part can be array or string. If its string then its treated as absolute path to file which should\nreturn array of configuration. Each or array configuration parts is merged. Look for `Examples`_ for better\nunderstanding.\n\n- | **host**\n  | *default value:* null\n  |\n  | Database host.\n\n  |\n- | **user**\n  | *default value:* null\n  |\n  | Database user.\n\n  |\n- | **password**\n  | *default value:* null\n  |\n  | Database user password.\n\n  |\n- | **dbname**\n  | *default value:* null\n  |\n  | Database name.\n\n  |\n- | **truncate_tables**\n  | *default value:* null\n  |\n  | Array of tables names that will be truncated with task `db:truncate`_. Usually it should be some caching tables that\n    will be truncated while deployment. The value is put between ^ and $ and treated as preg_match. For example\n    you can write \"cf\\_.*\" to truncate all tables that starts with \"cf\\_\". The final preg_match checked is /^cf\\_.*$/i\n\n  |\n- | **ignore_tables_out**\n  | *default value:* null\n  |\n  | Array of tables names that will be ignored while pulling database from target instance with task `db:pull`_\n    The value is put between ^ and $ and treated as preg_match. For example you can write \"cf\\_.*\" to truncate all\n    tables that starts with \"cf\\_\". The final preg_match checked is /^cf\\_.*$/i\n\n  |\n- | **post_sql_in**\n  | *default value:* null\n  |\n  | SQL that will be executed after importing database on local instance.\n\n  |\n- | **post_sql_in_markers**\n  | *default value:* null\n  |\n  | SQL that will be executed after importing database on local instance. The diffrence over \"post_sql_in\"\n    is that you can use some predefined markers. For now only marker is {{domainsSeparatedByComma}} which consist of all\n    domains defined in ``-\u003eset('public_urls', ['https://live.example.com']);`` and separated by comma. Having such\n    marker allows to change active domain in database after import to other instance as some frameworks keeps domain\n    names in database.\n\n\nExamples\n--------\n\nBelow examples should illustrate how you should build your database configuration.\n\nConfig with one database and database data read from .env file\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\ndeploy.php file:\n::\n\n   set('db_default', [\n      'ignore_tables_out' =\u003e [\n          'caching_.*'\n      ]\n   ]);\n\n   host('live')\n         -\u003esetHostname('my-server.example.com')\n         -\u003esetRemoteUser('deploy')\n         -\u003eset('bin/php', '/usr/bin/php82')\n         -\u003eset('deploy_path', '/var/www/myapplication')\n         -\u003eset('db_databases',\n            [\n              'database_foo' =\u003e [\n                  get('db_default'),\n                  (new \\SourceBroker\\DeployerExtendedDatabase\\Driver\\EnvDriver())-\u003egetDatabaseConfig()\n               ],\n            ]\n         );\n\n   localhost('local')\n         -\u003eset('deploy_path', getcwd())\n         -\u003eset('bin/php', 'php')\n         -\u003eset('db_databases',\n            [\n              'database_foo' =\u003e [\n                  get('db_default'),\n                  (new \\SourceBroker\\DeployerExtendedDatabase\\Driver\\EnvDriver())-\u003egetDatabaseConfig()\n               ],\n            ]\n         );\n\nMind that because the db_* settings for all hosts will be the same then you can make the 'db_databases' setting global\nand put it out of host configurations. Look for below example where we simplified the config.\n\ndeploy.php file:\n::\n\n   set('db_databases',\n       [\n           'database_foo' =\u003e [\n               'ignore_tables_out' =\u003e [\n                  'caching_.*'\n               ]\n               (new \\SourceBroker\\DeployerExtendedDatabase\\Driver\\EnvDriver())-\u003egetDatabaseConfig()\n            ],\n       ]\n   );\n\n   host('live')\n       -\u003esetHostname('my-server.example.com')\n       -\u003esetRemoteUser('deploy')\n       -\u003eset('bin/php', '/usr/bin/php82')\n       -\u003eset('deploy_path', '/var/www/myapplication/');\n\n   localhost('local')\n      -\u003eset('bin/php', 'php')\n      -\u003eset('deploy_path', getcwd());\n\n\nThe .env file should look then like:\n::\n\n   INSTANCE=\"[instance name]\"\n\n   DATABASE_HOST=\"127.0.0.1\"\n   DATABASE_NAME=\"database_name\"\n   DATABASE_USER=\"database_user\"\n   DATABASE_PASSWORD=\"password\"\n\nConfig with two databases and database data read from .env file\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\ndeploy.php file:\n::\n\n   set('db_databases',\n       [\n            'database_application1' =\u003e [\n               'ignore_tables_out' =\u003e [\n                  'caching_.*'\n               ]\n            (new \\SourceBroker\\DeployerExtendedDatabase\\Driver\\EnvDriver())-\u003egetDatabaseConfig('APP1_')\n         ],\n            'database_application2' =\u003e [\n               'ignore_tables_out' =\u003e [\n                  'cf_.*'\n                ]\n            (new \\SourceBroker\\DeployerExtendedDatabase\\Driver\\EnvDriver())-\u003egetDatabaseConfig('APP2_')\n         ],\n       ]\n   );\n\n   host('live')\n       -\u003esetHostname('my-server.example.com')\n       -\u003esetRemoteUser('deploy')\n       -\u003eset('bin/php', '/usr/bin/php82')\n       -\u003eset('deploy_path', '/var/www/myapplication/');\n\n   localhost('local')\n      -\u003eset('bin/php', 'php')\n      -\u003eset('deploy_path', getcwd());\n\nThe .env file should look then like:\n::\n\n   INSTANCE=\"[instance name]\"\n\n   APP1_DATABASE_HOST=\"127.0.0.1\"\n   APP1_DATABASE_NAME=\"database_name\"\n   APP1_DATABASE_USER=\"database_user\"\n   APP1_DATABASE_PASSWORD=\"password\"\n\n   APP2_DATABASE_HOST=\"127.0.0.1\"\n   APP2_DATABASE_NAME=\"database_name\"\n   APP2_DATABASE_USER=\"database_user\"\n   APP2_DATABASE_PASSWORD=\"password\"\n\nConfig with one database and database config read from from different sources\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\nIn example we will use:\n\n1) array,\n   ::\n\n      'ignore_tables_out' =\u003e [\n                  'caching_*'\n               ]\n\n2) get() which returns array with database options,\n   ``get('db_default')``\n\n3) direct file include which returns array with database options\n   ``__DIR__ . '/.dep/database/config/additional_db_config.php``\n\n4) class/method which returns array with database options\n   ``(new \\YourVendor\\YourPackage\\Driver\\MyDriver())-\u003egetDatabaseConfig()``\n\n5) closure which returns array with database options\n   ``function() { return (new \\YourVendor\\YourPackage\\Driver\\MyDriver())-\u003egetDatabaseConfig()`` }\n\nEach of this arrays are merged to build final configuration for database synchro.\n\ndeploy.php file:\n::\n\n   set('db_default', [\n      'post_sql_in' =\u003e 'UPDATE sys_domains SET hidden=1;'\n   ]);\n\n   set('db_databases',\n       [\n           'database_foo' =\u003e [\n               [\n                   'ignore_tables_out' =\u003e [\n                      'caching_.*'\n                   ]\n               ],\n               get('db_default'),\n               __DIR__ . '/databases/config/additional_db_config.php',\n               (new \\YourVendor\\YourPackage\\Driver\\MyDriver())-\u003egetDatabaseConfig(),\n               function() {\n                  return (new \\YourVendor\\YourPackage\\Driver\\MyDriver())-\u003egetDatabaseConfig();\n               }\n            ],\n       ]\n   );\n\n   host('live')\n       -\u003esetHostname('my-server.example.com')\n       -\u003esetRemoteUser('deploy')\n       -\u003eset('bin/php', '/usr/bin/php82')\n       -\u003eset('deploy_path', '/var/www/myapplication/');\n\n   localhost('local')\n      -\u003eset('bin/php', 'php')\n      -\u003eset('deploy_path', getcwd());\n\n\nConfig with one database and database config read from \"my framework\" file\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\nIts advisable that you create you own special method that will return you framework database data. In below example\nits call to ``\\YourVendor\\YourPackage\\Driver\\MyDriver()``. This way you do not need to repeat the data of database\nin .env file. In that case .env file should hold only INSTANCE.\n::\n\n   set('db_databases',\n          [\n              'database_default' =\u003e [\n                  (new \\YourVendor\\YourPackage\\Driver\\MyDriver())-\u003egetDatabaseConfig()\n              ],\n          ]\n      );\n\n\nConfig of truncate_tables, ignore_tables_out, post_sql_in_markers\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\nReal life example for CMS TYPO3:\n::\n\n   set('db_default', [\n       'truncate_tables' =\u003e [\n           'cf_.*'\n       ],\n       'ignore_tables_out' =\u003e [\n           'cf_.*',\n           'cache_.*',\n           'be_sessions',\n           'fe_sessions',\n           'sys_file_processedfile',\n           'tx_devlog',\n       ],\n   ]);\n\n\nTasks\n-----\n\ndb:backup\n+++++++++\n\nBackup database. In background, on target instance, three tasks are executed `db:export`_, `db:compress`_ and `db:dumpclean`_.\nResults are stored in ``{{deploy_path}}/.dep/databases/dumps/``.\n\nIf ``release`` folder will be detected on ``deploy_path`` (means we are in process of deploy) then it adds two tags to dump name:\n``release`` and ``release_[number]`` like in example below:\n``2025-03-01_23-36-25#server=local#dbcode=database_default#dumpcode=e8cd33191dffe1642d3e9fb6bf99090f#tags=release+release_91#type=structure.sql.gz``\n\nYou can add you own tags with ``--options=tags:tag1+tag2``. Example:\n``2025-03-01_23-36-25#server=local#dbcode=database_default#dumpcode=e8cd33191dffe1642d3e9fb6bf99090f#tags=tag1+tag2#type=structure.sql.gz``\n\n**Example**\n::\n\n   dep db:backup local\n   dep db:backup live\n   dep db:backup live --options=dumpcode:mycode\n   dep db:backup live --options=dumpcode:mycode,tags:tag1+tag2\n\ndb:compress\n+++++++++++\n\nCompress dumps with given dumpcode stored in folder ``{{deploy_path}}/.dep/databases/dumps/``\"`` on target instance.\nThere is required option ``--options=dumpcode:[value]`` to be passed.\n\nLook for config vars ``db_compress_suffix``, ``db_compress_command``, ``db_uncompress_command`` for possible ways to overwrite\nstandard gzip compression with your own.\n\n**Example**\n::\n\n   dep db:compress live --options=dumpcode:0772a8d396911951022db5ea385535f6\n\n\ndb:copy\n+++++++\n\nThis command allows you to copy database between instances.\n::\n\n   dep db:copy [source-instance] --options=target:[target-instance]\n\nIn the background it runs several other tasks to accomplish this. Lets assume we want to copy database from live\nto dev instance. We will run following command on you local instance:\n\n::\n\n   dep db:copy live --options=target:dev\n\nHere are the tasks that will be run in background:\n\nIn below description:\n   * source instance = live\n   * target instance = dev\n   * local instance = local\n\n1) First it runs ``dep db:export live --options=dumpcode:123456`` task on source instance. The dumps from export task are stored\n   in folder ``{{deploy_path}}/.dep/databases/dumps/`` on target instance.\n\n2) Then it runs ``db:download live --options=dumpcode:123456`` on local instance to download dump files from live instance from\n   folder ``{{deploy_path}}/.dep/databases/dumps/`` to local instance to folder ``{{deploy_path}}/.dep/databases/dumps/``. The dump at\n   source instance is deleted at this point because already downloaded.\n\n3) Then it runs ``db:process local --options=dumpcode:123456`` on local instance to make some operations directly on SQL dumps files.\n\n4) Then it runs ``db:upload dev --options=dumpcode:123456`` on local instance. This task takes dump files with ``code:123456``\n   and send it to dev instance and store it in folder ``{{deploy_path}}/.dep/databases/dumps/``. The dump at\n   local instance is deleted at this point because already uploaded to target instance.\n\n5) Then it make backup of target database before importing the dump.\n\n6) Finally it runs ``db:import dev --options=dumpcode:123456`` on target instance. This task reads dumps with ``code:123456`` from folder\n   ``{{deploy_path}}/.dep/databases/dumps/`` on dev instance and import it to database.\n\n7) At the very end it runs `db:dumpclean`_ to clean up old dumps on target instance.\n\nCopy to instance defined in ``instance_live_name`` (default ``live``) is special case.\nIf you copy to highest instance then by default you will be asked twice if you really want to.\nYou can disable asking by setting ``db_allow_copy_live_force`` to ``true``.\nYou can also forbid copy to live instance by setting ``db_allow_copy_live`` to ``false``.\n\ndb:decompress\n+++++++++++++\n\nDecompress dumps with given dumpcode stored in folder ``{{deploy_path}}/.dep/databases/dumps/`` on target instance.\nThere is required option ``--options=dumpcode:[value]`` to be passed.\n\nLook for config vars ``db_compress_suffix``, ``db_compress_command``, ``db_uncompress_command`` for possible ways to overwrite\nstandard gzip compression with your own.\n\n**Example**\n::\n\n   dep db:decompress live --options=dumpcode:0772a8d396911951022db5ea385535f6\n\ndb:download\n+++++++++++\n\nDownload database dumps with selected dumpcode from folder ``{{deploy_path}}/.dep/databases/dumps/`` on target instance\nand store it in folder ``{{deploy_path}}/.dep/databases/dumps/`` on local instance.\nThere is required option ``--options=dumpcode:[value]`` to be passed.\n\n**Example**\n::\n\n   dep db:download live --options=dumpcode:0772a8d396911951022db5ea385535f6\n\ndb:dumpclean\n++++++++++++\n\nClean database dump storage on target instance. By default it removes all dumps except last five but you can set your\nvalues and also change the values depending on instance.\n\n**Example**\n::\n\n   set('db_dumpclean_keep', 10); // keep last 10 dumps for all instances\n\n   set('db_dumpclean_keep', [\n      'live' =\u003e 10 // keep last 10 dumps for live instance dumps\n      'dev' =\u003e 5   // keep last 5 dumps for dev instance dumps\n      '*' =\u003e 2     // keep last 5 dumps for all other instances dumps\n   ]);\n\n   dep db:dumpclean live\n\ndb:export\n+++++++++\n\nDump database to folder on local instance located by default in ``{{deploy_path}}/.dep/databases/dumps/``.\nDumps will be stored in two separate files. One with tables structure. The second with data only.\nThere is required option ``--options=dumpcode:[value]`` to be passed.\n\n**Example**\n\nExample task call:\n::\n\n   dep db:export live --options=dumpcode:362d7ca0ff065f489c9b79d0a73720f5\n\nExample output files located in folder {{deploy_path}}/.dep/databases/dumps/:\n::\n\n   2025-02-26_14:56:08#server=live#dbcode=database_default#type=data#dumpcode=362d7ca0ff065f489c9b79d0a73720f5.sql\n   2025-02-26_14:56:08#server=live#dbcode=database_default#type=structure#dumpcode=362d7ca0ff065f489c9b79d0a73720f5.sql\n\n\ndb:import\n+++++++++\n\nImport database dump files to target database(s). Files are taken from folder ``{{deploy_path}}/.dep/databases/dumps/``\non target instance. There is required option ``--options=dumpcode:[value]`` to be passed.\n\n**Example**\n::\n\n   dep db:import dev --options=dumpcode:0772a8d396911951022db5ea385535f66\n\n\n\ndb:process\n++++++++++\n\nThis command will run some defined commands on pure sql file as its sometimes needed to remove or replace some strings\ndirectly on sql file before importing. There is required option ``--options=dumpcode:[value]`` to be passed.\n\n**Example**\n::\n\n   dep db:process local --options=dumpcode:0772a8d396911951022db5ea385535f66\n\ndb:pull\n+++++++\n\nThis command allows you to pull database from target instance to local instance.\nIn the background it runs several other tasks to accomplish this.\n\nPull to instance defined in ``instance_live_name`` (default ``live``) is special case.\nIf you pull to highest instance then by default you will be asked twice if you really want to.\nYou can disable asking by setting ``db_allow_pull_live_force`` to ``true``.\nYou can also forbid pull to live instance by setting ``db_allow_pull_live`` to ``false``.\n\nWhen option ``--options=fromLocalStorage`` is set the it does not export from remote host but use local files from\n``{{deploy_path}}/.dep/databases/dumps/`` folder. Useful to repeat import of database (for example to test upgrade process)\nwithout getting it again and again from remote host.\n\n**Example**\n::\n\n   # export from live and import on current host\n   dep db:pull live\n\n   # import from database storage of current host\n   dep db:pull live --options=fromLocalStorage\n\ndb:push\n+++++++\n\nThis command allows you to push database from local instance to remote instance.\nIn the background it runs several other tasks to accomplish this.\n\nHere is the list of tasks that will be done when you execute \"db:push\":\n\n1) First it runs `db:export`_ task on local instance.\n2) Then it runs `db:upload`_ on local instance with remote as argument.\n3) Then it runs `db:process`_ on remote instance.\n4) Then it runs `db:backup`_ on remote instance to make backup before import.\n5) Then it runs `db:import`_ on remote instance.\n\nPush to instance defined in ``instance_live_name`` (default ``live``) is special case.\nIf you push to highest instance then by default you will be asked twice if you really want to.\nYou can disable asking by setting ``db_allow_push_live_force`` to ``true``.\nYou can also forbid push to live instance by setting ``db_allow_push_live`` to ``false``.\n\n**Example**\n::\n\n   dep db:push live\n\ndb:rmdump\n+++++++++\n\nThis command will remove all dumps with given dumpcode (compressed and uncompressed).\nThere is required option ``--options=dumpcode:[value]`` to be passed.\n\n**Example**\n::\n\n   dep db:rmdump live --options=dumpcode:0772a8d396911951022db5ea385535f66\n\ndb:truncate\n+++++++++++\n\nThis command allows you to truncate database tables defined in database config var \"truncate_tables\".\nNo dumpcode is needed because it operates directly on database.\n\n**Example**\nTruncate local instance databases tables.\n::\n\n   dep db:truncate\n\nTruncate live instance databases tables.\n::\n\n   dep db:truncate live\n\ndb:upload\n+++++++++\n\nUpload database dumps with selected dumpcode from folder ``{{deploy_path}}/.dep/databases/dumps/`` on local instance and\nstore it in folder ``{{deploy_path}}/.dep/databases/dumps/`` on target instance.\nThere is required option ``--options=dumpcode:[value]`` to be passed.\n\n**Example**\n::\n\n   dep db:upload live --options=dumpcode:0772a8d396911951022db5ea385535f6\n\n\nChangelog\n---------\n\nSee https://github.com/sourcebroker/deployer-extended-database/blob/master/CHANGELOG.rst\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcebroker%2Fdeployer-extended-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsourcebroker%2Fdeployer-extended-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcebroker%2Fdeployer-extended-database/lists"}