{"id":21854167,"url":"https://github.com/gmemstr/database-janitor","last_synced_at":"2025-04-14T16:41:28.579Z","repository":{"id":41094914,"uuid":"156928381","full_name":"gmemstr/database-janitor","owner":"gmemstr","description":"custommized database dumps, with native drupal configuration support","archived":false,"fork":false,"pushed_at":"2023-03-11T07:30:30.000Z","size":172,"stargazers_count":3,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T05:23:44.356Z","etag":null,"topics":["cleanup","database","database-management","php","sql"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gmemstr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-11-09T23:15:41.000Z","updated_at":"2022-06-28T11:56:33.000Z","dependencies_parsed_at":"2024-11-28T01:31:19.770Z","dependency_job_id":"605c201d-410a-481a-a771-f7d552e370bb","html_url":"https://github.com/gmemstr/database-janitor","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmemstr%2Fdatabase-janitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmemstr%2Fdatabase-janitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmemstr%2Fdatabase-janitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmemstr%2Fdatabase-janitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gmemstr","download_url":"https://codeload.github.com/gmemstr/database-janitor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248918173,"owners_count":21183128,"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":["cleanup","database","database-management","php","sql"],"created_at":"2024-11-28T01:29:05.141Z","updated_at":"2025-04-14T16:41:28.559Z","avatar_url":"https://github.com/gmemstr.png","language":"PHP","readme":"\u003cp align=\"right\"\u003eInitial development funded by Acro Media Inc.\u003c/p\u003e\n\nDatabase Janitor\n---\n\nHighly-configurable database dumper\n\n## Features\n\n - Drupal configuration support\n - Configuration-first\n - PHP with minimal dependencies\n\n## Usage\n\nThis application can either be used as a CLI app or a library that other applications can build on top of, e.g a drush\ncommand or another custom application.\n\n## Command Help\n\n```bash\nDescription:\n  Cleans up databases between servers or dev enviornments\n\nUsage:\n  database-janitor [options] [--] \u003cdatabase\u003e\n\nArguments:\n  database                   Database to dump\n\nOptions:\n      --host[=HOST]          Database host, defaults to localhost\n  -u, --username[=USERNAME]  Database username\n  -p, --password[=PASSWORD]  Database password\n  -t, --trim                 Whether or not to exclude data from dump (trimming)\n  -d, --drupal=DRUPAL        Path to a Drupal settings file (ignores host, username and password flags)\n  -h, --help                 Display this help message\n  -q, --quiet                Do not output any message\n  -V, --version              Display this application version\n      --ansi                 Force ANSI output\n      --no-ansi              Disable ANSI output\n  -n, --no-interaction       Do not ask any interactive question\n  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n```\n\n### Configuration\n\n```yaml\nsanitize_tables:\n  # List of tables and their columns you want sanitized.\n  user:\n  - mail\ntrim_tables:\n# List of tables to be trimmed (every 4th row kept)\n  - trim1\nexcluded_tables:\n# Tables to NOT dump\n  - exclude1\nscrub_tables:\n# Tables to dump sans content.\n  - scrub1\nkeep_data:\n# Keep data in these tables by key\n  table_name:\n    col: col_name\n    # Only row with col value of 1\n    rows:\n      - 1\n  table_name_2:\n  # Every other row, using mod\n    col: other_col_name\n    rows: 2\n\n  table_name_3:\n  # Every row with a value of 1, 3 or 8.\n    col: third_col_name\n    rows: 1, 3, 8\n```\n\n### CLI\n\nFirst you'll want to copy `.janitor.example.yml` to `.janitor.yml`. You can then go in and edit exactly which tables and\ncolumns you want sanitized/ignored/cleared.\n\nIf not using the .phar, install dependencies with `composer install`.\n\n#### Dumping\n\nThis will prompt you for the database password, then produce a gzip'd .sql file in the `output/` directory.\n\n```bash\n./janitor.phar --host=localhost:8787 --username=real real | gzip -c \u003e output/real_test.sql.gz\n```\n\n#### Trimming\n\nTrimming allows much smaller database dumps by reducing the data exported through the use of keeping data, scrubbing tables, and so on. \n\n```bash\n./janitor.phar --host=localhost:8787 --username=real --trim real | gzip -c \u003e output/real_test.sql.gz\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmemstr%2Fdatabase-janitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgmemstr%2Fdatabase-janitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmemstr%2Fdatabase-janitor/lists"}