I hereby claim:
- I am mattboutet on github.
- I am mattboutet (https://keybase.io/mattboutet) on keybase.
- I have a public key ASC8ap5IkUNjGQOhW-kxaRKNS1wid7_nrnmXM5glX98B_Ao
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
//From https://www.vincit.fi/en/blog/effortless-eager-loading-nested-inserts-objection-js/ | |
//There's a bunch of code here that's not needed for this example, but I was trying to keep edits to a minimum | |
//Stick this in a directory, then `npm install objection knex sqlite3` | |
//to run: node app.js | |
//Changing reviewerId to reviewer in the code below will cause the problem I'm talking about | |
'use strict'; | |
const objection = require('objection'); |
# Ensure flavor and pal branch are up-to-date locally
git checkout flavor-<name> # Go to the flavor branch
git merge pal/pal # Ensure we're not squashing irrelevant changes, e.g. to the readme
git push pal flavor-<name> # Push the updated flavor branch
git reset pal/pal # See the changes as they appear on top of the main pal branch
git checkout --detach # Leave the current branch– at this point we dont need to update any branch
git add ... # List updated files
git commit -m "(flavor) <name> v<major>.<minor>.<patch>" # Create the squashed commit
// Because we're using an ORM (Objection), it's a pain to add a tsvector when inserting, | |
// since tsvectors and FTS aren't supported by Objection. Instead, I've added a hook that | |
// fires on insert which auto-generates the tsvector field for each newly inserted entry. | |
// This is an example knex migration file for said behavior. | |
const addUserIndex = ` | |
ALTER TABLE public.user ADD "document" tsvector; | |
CREATE FUNCTION my_trigger_function() | |
RETURNS trigger AS $$ |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |