A PostgreSQL (10) schema for storing microformats2 objects (as the canonical JSON representation), featuring:
- Fast storage and querying (jsonb + GIN)
- Uniqueness constraint on the first
url
value - Full text search
- Automatic insert/update/delete notifications
- Denormalization (embed linked objects like replies for exporting into JSON files or rendering to HTML templates)
- Normalization (un-embed linked objects when importing from JSON files)
- And more
- Create a database e.g.
sudo -u postgres createdb mywebsite
- Run
SELECT current_setting('default_text_search_config');
to check if your default language for full text search matches your website's (if not, change that setting) - Run the migrations using migrate e.g.
migrate -path=migrations -url=postgres://localhost/mywebsite\?sslmode=disable up
(or just run themigrations/*.up.sql
files withpsql
if you don't want to bother withmigrate
) (so far there's only one migration) - Install the functions by running
psql
onfunctions/*.sql
- Import JSON files using
import.rb
if you want
Grab pgTAP (including pg_prove
) to run the tests!
Please feel free to submit pull requests!
By participating in this project you agree to follow the Contributor Code of Conduct.
The list of contributors is available on GitHub.
This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE
file or unlicense.org.