Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/purcell/postgresql-migrations
Simple Schema Migrations for PostgreSQL
https://github.com/purcell/postgresql-migrations
Last synced: 30 days ago
JSON representation
Simple Schema Migrations for PostgreSQL
- Host: GitHub
- URL: https://github.com/purcell/postgresql-migrations
- Owner: purcell
- License: mit
- Created: 2017-09-16T10:00:26.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-12T05:35:48.000Z (about 5 years ago)
- Last Synced: 2024-08-05T09:18:15.566Z (3 months ago)
- Language: PLpgSQL
- Size: 9.77 KB
- Stars: 47
- Watchers: 6
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- jimsghstars - purcell/postgresql-migrations - Simple Schema Migrations for PostgreSQL (PLpgSQL)
README
[![Build Status](https://travis-ci.org/purcell/postgresql-migrations.svg?branch=master)](https://travis-ci.org/purcell/postgresql-migrations)
## Simple Schema Migrations for PostgreSQL
### About
This repository, which began as a simple Gist, provides a tiny starter
kit and instructions for safely performing schema migrations on a
PostgreSQL database. It works by providing a PLPGSQL procedure which
can execute a chunk of SQL and then note it as having been executed,
so that it will not be executed again the next time.We're actively using this in production over at NEC Smart Cities with
great success, so it is now somewhat proven and maintained.### Installation
Copy `migrations.sql` to your project. Add migrations to the end of
that file in the form of calls to `apply_migration`, as shown in the
examples in that file. To apply all pending migrations, including
bootstrapping the migration function and its `migrations` table, run
the file against your database in a single transaction with psql, or
via your database connection adaptor.```
psql -v ON_ERROR_STOP=1 -1f -- migrations.sql yourdbname
```You should generally arrange to run migrations as the database owner
(or even the super-user), and your applications should use
less-privileged users.### Author
This software was written by
[Steve Purcell](https://github.com/purcell).### License and copyright
MIT license.
Author links:
[💝 Support this project and my other Open Source work](https://www.patreon.com/sanityinc)
[💼 LinkedIn profile](https://uk.linkedin.com/in/stevepurcell)
[✍ sanityinc.com](http://www.sanityinc.com/)
[🐦 @sanityinc](https://twitter.com/sanityinc)