{"id":18581988,"url":"https://github.com/chilts/patchy","last_synced_at":"2026-04-28T18:03:27.027Z","repository":{"id":57598759,"uuid":"91027395","full_name":"chilts/patchy","owner":"chilts","description":"Easy patching of your Postgres database.","archived":false,"fork":false,"pushed_at":"2017-10-15T23:47:05.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-27T04:37:04.208Z","etag":null,"topics":["golang","postgresql"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chilts.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}},"created_at":"2017-05-11T22:06:16.000Z","updated_at":"2021-05-23T21:38:33.000Z","dependencies_parsed_at":"2022-08-30T01:52:31.092Z","dependency_job_id":null,"html_url":"https://github.com/chilts/patchy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chilts/patchy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chilts%2Fpatchy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chilts%2Fpatchy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chilts%2Fpatchy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chilts%2Fpatchy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chilts","download_url":"https://codeload.github.com/chilts/patchy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chilts%2Fpatchy/sbom","scorecard":{"id":277711,"data":{"date":"2025-08-11","repo":{"name":"github.com/chilts/patchy","commit":"8c18a82620ea8a4a4fd9cae8f77f0fb230aa87e6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: License:0","Info: FSF or OSI recognized license: Apache License 2.0: License:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T14:56:57.891Z","repository_id":57598759,"created_at":"2025-08-17T14:56:57.891Z","updated_at":"2025-08-17T14:56:57.891Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32392304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: 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":["golang","postgresql"],"created_at":"2024-11-07T00:08:45.075Z","updated_at":"2026-04-28T18:03:27.012Z","avatar_url":"https://github.com/chilts.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# patchy : Easy patching of your Postgres database\n\n## Overview [![GoDoc](https://godoc.org/github.com/chilts/patchy?status.svg)](https://godoc.org/github.com/chilts/patchy) [![Build Status](https://travis-ci.org/chilts/patchy.svg?branch=master)](https://travis-ci.org/chilts/patchy)\n\nPatchy aims to provide you both a binary you can use to patch your database, or a library you can use when starting\nyour app to make sure your database is patched to the level required by your app. You could also run this as a separate\nprogram as part of your deployment workflow.\n\nPatches are written in simple files (\"0001-forward.sql\" and \"0001-reverse.sql\") and patchy will run all patches\nrequired to bring your database up to the level required.\n\n## Install\n\n```\ngo get github.com/chilts/patchy\n```\n\n## Example\n\nOpen the database, set a couple of options and call `patchy.Patch`:\n\n```\ndb, err := sql.Open(\"postgres\", \"...\")\n\nlevel := 17\nopts := patchy.Options{\n\tDir:           \"schema\",\n\tPropertyTable: \"property\",\n}\nnewLevel, err := patchy.Patch(db, level, \u0026opts)\nif err != nil {\n\t// `newLevel` will be the level we managed to patch to\n    // but we didn't make it to the patch requested.\n}\n// `newLevel` will be 17 and `err` will be `nil`\n```\n\n## Best Practices ##\n\nRemember that sometimes you will patch your database prior to updating your deployed code. This will happen either\nbecause you're deploying a canary for your new release and therefore it needs the updated schema, or because you're\njust stopping your (single) webserver, upgrading, and patching the database when the new webserver restarts.\n\nUltimately this means that you should make sure that if you have two programs in production that require v4 or v5 of\nthe database schema, that you make your schema changes backwards compatible and can be used by two successive versions\nof the webserver.\n\nTo do this, you may have to perform changes over two or (possibly) three schema patches. In reality this isn't a big\nproblem but it does mean you have to forward plan a little bit. When I was working at Mozilla working on Firefox\nAccounts, we also made sure each program checked the patch version of the database to make sure it was either at the\nversion it expected, or the version+1 of the version expected. It quit if the database didn't satisfy the level\nexpected.\n\nWe also noticed some drawbacks to this kind of database patching, however in my opinion, this is a great procedure for\nsmall to medium sized projects. Also, we used MySql at Mozilla which was also a pain because it didn't have\ntransactional DDL like Postgres does. Either way, I think we could have gotten around some of our difficulties by\nseparating our patches out into separate releases. (See the\n[mysql-patcher](https://www.npmjs.com/package/mysql-patcher) project and it's use in the\n[fxa-auth-db-mysql](https://github.com/mozilla/fxa-auth-db-mysql/blob/e0088495b7a8a56af0a9d3b823bab801a7745c3f/bin/db_patcher.js)\nproject. There is also some notes on\n[stored procedures here](https://github.com/mozilla/fxa-auth-db-mysql/blob/526ee73bfb9ea0c77c92d73bfcc20d6975fa453b/lib/db/schema/README.md#stored-procedures-and-future-patches)\nwhich might be of interest.\n\n## Author\n\nBy [Andrew Chilton](https://chilts.org/), [@twitter](https://twitter.com/andychilton).\n\nFor [AppsAttic](https://appsattic.com/), [@AppsAttic](https://twitter.com/AppsAttic).\n\n## License\n\nApache 2.0.\n\n(Ends)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchilts%2Fpatchy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchilts%2Fpatchy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchilts%2Fpatchy/lists"}