{"id":50048683,"url":"https://github.com/ozh/yourls-postgresql","last_synced_at":"2026-06-27T07:03:05.252Z","repository":{"id":357843895,"uuid":"1237974723","full_name":"ozh/yourls-postgresql","owner":"ozh","description":"🐘 PostgreSQL plugin for YOURLS","archived":false,"fork":false,"pushed_at":"2026-06-12T03:23:38.000Z","size":62,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-06-18T20:04:23.789Z","etag":null,"topics":["postgresql","yourls","yourls-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/ozh.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-13T17:32:08.000Z","updated_at":"2026-06-12T22:13:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ozh/yourls-postgresql","commit_stats":null,"previous_names":["ozh/yourls-postgresql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ozh/yourls-postgresql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozh%2Fyourls-postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozh%2Fyourls-postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozh%2Fyourls-postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozh%2Fyourls-postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ozh","download_url":"https://codeload.github.com/ozh/yourls-postgresql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozh%2Fyourls-postgresql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34844350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["postgresql","yourls","yourls-plugin"],"created_at":"2026-05-21T08:00:58.896Z","updated_at":"2026-06-27T07:03:05.246Z","avatar_url":"https://github.com/ozh.png","language":"PHP","funding_links":[],"categories":["Plugins"],"sub_categories":["P"],"readme":"# PostgreSQL Support for YOURLS [![Listed in Awesome YOURLS!](https://img.shields.io/badge/Awesome-YOURLS-C5A3BE)](https://github.com/YOURLS/awesome-yourls/) [![CI](https://github.com/ozh/yourls-postgresql/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/ozh/yourls-postgresql/actions/workflows/ci.yml)\n\u003e \u003cimg width=\"200\" alt=\"yourls-love-pgsql\" src=\"https://github.com/user-attachments/assets/96e844c8-100e-4b56-9cd7-e256d0d2d458\" /\u003e \n\nRequires [YOURLS](https://yourls.org) `1.10.4` and above.\n\n#### Table of Contents\n\n- [Quick start](#quick-start)\n- [Installation](#installation)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Quick start\n\n:information_source: **This is not a plugin**.\n\nA rather little known feature of YOURLS is that you can customize the DB engine or define\na new one with a custom `user/db.php` file : **simply drop `db.php` in `user/`**. There is\nnothing to look for or activate in the Plugins admin page.\n\nStarting with YOURLS `1.10.4`, SQL queries can be rewritten on the fly. This code modifies each\nMySQL query to be compatible with [PostgreSQL](https://www.postgresql.org/). It should pass all\n[YOURLS unit tests](https://github.com/ozh/yourls-postgresql/actions/workflows/ci.yml?query=branch%3Amaster)\nunder various PostgreSQL versions, and work with all YOURLS features, including plugins.\n\n## Installation\n\n### Prerequisites : PostgreSQL up and running, obviously\n\nThis is out of scope, but things may be along the lines of:\n\n* `postgres` in your `docker-compose.yml`:\n  ```yaml\n    postgres:\n      image: postgres:16\n      container_name: dev-postgres\n      environment:\n        POSTGRES_PASSWORD: root\n        POSTGRES_DB: dev\n      ports:\n        - \"5432:5432\"\n      volumes:\n        - postgres_data:/var/lib/postgresql/data\n  ```\n* Needed libraries and binaries :\n  ```sh\n  sudo apt install postgresql-client-common\n  sudo apt install postgresql-client-16\n  ```\n\nModify this as needed for your setup -- refer to available documentation if unsure.\n\n\n### Create user and database, matching your `config.php`:\n\nConnect to `psql` (with password `root` if using Docker setup above):\n\n```bash\npsql -h localhost -p 5432 -U postgres -d dev\n```\n\nThen in the `psql` shell, type:\n```sql\n-- Create user 'yourls_user' with password 'yourls_password'\nDROP USER IF EXISTS yourls;\nCREATE USER yourls_user WITH PASSWORD 'yourls_password';\n\n-- Create DB 'yourls_db'\nCREATE DATABASE yourls_db OWNER yourls_user;\n\n-- Give all privileges to user 'yourls_user' on DB 'yourls_db'\nGRANT ALL PRIVILEGES ON DATABASE yourls_db TO yourls_user;\n\n-- Check user, check databases\n\\du\n\\l\n\n-- Once everything is OK, quit the psql shell\n\\q\n```\n\nA matching YOURLS `config.php` would look like this:\n```php\ndefine('YOURLS_DB_USER', 'yourls_user');\ndefine('YOURLS_DB_PASS', 'yourls_password');\ndefine('YOURLS_DB_HOST', 'postgres'); // or for instance 'localhost:5432' if not using Docker\ndefine('YOURLS_DB_NAME', 'yourls_db'); \n```\n\n### Migrate existing data\n\nIf you have an existing YOURLS installation with data in MySQL, you can migrate it to PostgreSQL using the provided `pgsql_migration.php` script.\n\nEdit `pgsql_migration.php` to set the correct MySQL and PostgreSQL connection parameters, then run:\n\n```sh\nphp pgsql_migration.php\n```\n\n## Contributing\n\nContributions are very welcome! I aim to keep this DB engine compatible with every future\nYOURLS release, and pass all unit tests against current YOURLS `master`\n\nIf you find a bug, please open an issue or, better, submit a pull request on GitHub.\n\n## License\n\nDo whatever the hell you want.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozh%2Fyourls-postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fozh%2Fyourls-postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozh%2Fyourls-postgresql/lists"}