From 9f86af1c705242369adb3406dd584ebf87fef1af Mon Sep 17 00:00:00 2001 From: Corey Martin Date: Fri, 4 Oct 2019 15:11:03 -0700 Subject: [PATCH] create unique index for upsert --- setup | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup b/setup index 49ef2cb..0006fa5 100755 --- a/setup +++ b/setup @@ -50,7 +50,8 @@ else setup_dedicated fi -heroku pg:psql -c 'create table windowed_counts(id serial primary key not null, time_window bigint not null, word text, count bigint not null);' HEROKU_POSTGRESQL_URL -a ${APP_NAME} +heroku pg:psql -c 'CREATE TABLE windowed_counts(id serial primary key NOT NULL, time_window bigint NOT NULL, word text, count bigint NOT NULL);' HEROKU_POSTGRESQL_URL -a ${APP_NAME} +heroku pg:psql -c 'CREATE UNIQUE INDEX windowed_counts_time_window_word ON windowed_counts(word text_ops,time_window int8_ops);' HEROKU_POSTGRESQL_URL -a ${APP_NAME} heroku ps:scale text_processor_worker=1 -a ${APP_NAME} heroku ps:scale aggregator_worker=1 -a ${APP_NAME}