README.md in pgslice-0.3.6 vs README.md in pgslice-0.4.0
- old
+ new
@@ -2,10 +2,12 @@
Postgres partitioning as easy as pie. Works great for both new and existing tables, with zero downtime and minimal app changes. Archive older data on a rolling basis to keep your database size under control.
:tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
+[![Build Status](https://travis-ci.org/ankane/pgslice.svg?branch=master)](https://travis-ci.org/ankane/pgslice)
+
## Install
pgslice is a command line tool. To install, run:
```sh
@@ -278,11 +280,11 @@
This set up allows you to read and write with the original table name with no knowledge it’s partitioned. However, there are a few things to be aware of.
### Writes
-If you use `INSERT` statements with a `RETURNING` clause (as frameworks like Rails do), you’ll no longer receive the id of the newly inserted record(s) back. If you need this, you can either:
+Before Postgres 10, if you use `INSERT` statements with a `RETURNING` clause (as frameworks like Rails do), you’ll no longer receive the id of the newly inserted record(s) back. If you need this, you can either:
1. Insert directly into the partition
2. Get value before the insert with `SELECT nextval('sequence_name')` (for multiple rows, append `FROM generate_series(1, n)`)
### Reads
@@ -312,10 +314,21 @@
pgslice prep <table> --no-partition
pgslice fill <table> --where "id > 1000" # use any conditions
pgslice swap <table>
```
+## Schema Updates
+
+Once a table is partitioned, here’s how to change the schema:
+
+- To add, remove, or modify a column, make the update on the master table only
+- To add or remove an index, make the update on the master table and all partitions
+
+## Declarative Partitioning
+
+Postgres 10 introduces [declarative partitioning](https://www.postgresql.org/docs/10/static/ddl-partitioning.html#ddl-partitioning-declarative). A major benefit is `INSERT` statements with a `RETURNING` clause work as expected. If you prefer to use trigger-based partitioning instead (not recommended), pass the `--trigger-based` option to the `prep` command.
+
## Upgrading
Run:
```sh
@@ -362,5 +375,15 @@
- [Report bugs](https://github.com/ankane/pgslice/issues)
- Fix bugs and [submit pull requests](https://github.com/ankane/pgslice/pulls)
- Write, clarify, or fix documentation
- Suggest or add new features
+
+To run tests, do:
+
+```sh
+git clone https://github.com/ankane/pgslice.git
+cd pgslice
+bundle install
+createdb pgslice_test
+bundle exec rake
+```