{"id":45345274,"url":"https://github.com/deeprave/dbscripts","last_synced_at":"2026-02-21T11:08:00.029Z","repository":{"id":117668571,"uuid":"571480815","full_name":"deeprave/dbscripts","owner":"deeprave","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-25T01:20:10.000Z","size":216,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-25T02:35:06.752Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deeprave.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2022-11-28T08:22:07.000Z","updated_at":"2025-04-25T01:20:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c55496c-762d-4919-a4bf-26316f55b996","html_url":"https://github.com/deeprave/dbscripts","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/deeprave/dbscripts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeprave%2Fdbscripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeprave%2Fdbscripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeprave%2Fdbscripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeprave%2Fdbscripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deeprave","download_url":"https://codeload.github.com/deeprave/dbscripts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeprave%2Fdbscripts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29679147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T09:33:50.764Z","status":"ssl_error","status_checked_at":"2026-02-21T09:33:19.949Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-02-21T11:07:59.434Z","updated_at":"2026-02-21T11:08:00.020Z","avatar_url":"https://github.com/deeprave.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DbScripts\n\nA collection of scripts for database management.\n\nDesigned for use with postgresql.\n\n## dbutil\nFormerly `dbcreate`, this script is used to create, remove and test for the existence of a database, and associated roles.\n\n```shell\nusage: dbutil [-h] [-c] [-r] [-t] [-e PREFIX] [-u URL] [-v VERBOSE] [-H HOST] [-P PORT] [-N NAME] [-R ROLE] [-U USER] [-p PSWD]\n\nCreate/remove/test for database for django using best practices.\n\noptions:\n  -h, --help            show this help message and exit\n  -c, --create          Create the database\n  -r, --remove          Completely remove the database and associated users/roles\n  -t, --test            Test to see if the database and roles exist\n  -e, --prefix          Prefix environment variables, with fallback to non-prefixed\n  -u URL, --url URL     Connection url: postgresql://host[:port]/database\n  -v VERBOSE, --verbose VERBOSE  Verbose output\n  -H HOST, --host HOST  override database hostname\n  -P PORT, --port PORT  override database port\n  -N NAME, --name NAME  override database name\n  -R ROLE, --role ROLE  override database owner role\n  -U USER, --user USER  override database username\n  -p PSWD, --pswd PSWD  override database password\n\ndatabase details are initially sourced from .env which can be overridden by the\ncommand line, either by specifying individual parts or the complete database url.\nsuperuser account details are sourced from .env in current or parent directories only.\n```\n\n## dbready\nThis script is used to test for the readiness of a database, and optionally to test for a connection to a specific database.\n\n```shell\nusage: dbready [-h] [-w] [-t TIMEOUT] [-s SLEEP] [-e PREFIX] [-d] [-q] [-u [URL]] [-v] [-H [HOST]] [-P [PORT]] [-N [NAME]] [-U [USER]] [-p [PSWD]]\n\ntest for database ready and optionally connection\n\noptions:\n  -h, --help                show this help message and exit\n  -w, --wait                Wait until ready\n  -t TIMEOUT, --timeout TIMEOUT  Wait timeout (0=infinite)\n  -s SLEEP, --sleep SLEEP   Sleep time between retries\n  -e, --prefix              Prefix environment variables, with fallback to non-prefixed\n  -d, --database            Test to see if the database exists (not just connect)\n  -q, --quiet               Do not report errors or progress\n  -u [URL], --url [URL]     Connection url: postgresql://host[:port]/database\n  -v, --verbose             Verbose output\n  -H [HOST], --host [HOST]  override database hostname\n  -P [PORT], --port [PORT]  override database port\n  -N [NAME], --name [NAME]  override database name\n  -U [USER], --user [USER]  override database username\n  -p [PSWD], --pswd [PSWD]  override database password\n\ndatabase details are initially sourced from .env which can be overridden by the\ncommand line, either by specifying individual parts or the complete database url.\nsuperuser account details are sourced from .env in current or parent directories only.\n```\n\n## Rationale\nMany web developers undertake many projects that require the use of a database, with a significant majority favouring PostgreSQL.\n\nThis toolkit provides a streamlined approach to database management, adhering to industry best practices.\n\nIt guarantees that:\n- The user affiliated with an application is not a superuser.\n- The user affiliated with an application is secured with a password.\n- The user inherits access to the database from a nologin role, which actually owns the database\n- Tables, sequences and other entities are not created in the superuser `postgres` database, to better support multi-tenancy with other applications.\n- Database metadata including credentials is placed within a `.env` file, or since 1.4 also supports fetching secrets from hashicorp vault.\n- The prefix option available with both commands allows setting a prefix (`\u003cprefix\u003e_\u003cname\u003e`) on environment variables, to allow multiple databases (with different users, roles, etc) to be managed in the same environment.\n  If the prefixed variable is not set, the non-prefixed variable is used as a fallback.\n  For convenience, setting the ENVPREFIX environment variable will set the default prefix for all commands.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeprave%2Fdbscripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeeprave%2Fdbscripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeprave%2Fdbscripts/lists"}