Skip to content

Commit

Permalink
feat(database): Enable pg_cron via migration
Browse files Browse the repository at this point in the history
Adds index regen into seed.sql
  • Loading branch information
ff6347 committed Jan 10, 2024
1 parent fd30880 commit 7e59e67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions supabase/migrations/20240110152129_enable-pg-cron.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE EXTENSION IF NOT EXISTS "pg_cron" WITH SCHEMA "extensions";

10 changes: 10 additions & 0 deletions supabase/seed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ CREATE INDEX ON processed_document_summaries USING ivfflat(summary_embedding vec

CREATE INDEX ON processed_document_summaries USING ivfflat(summary_embedding vector_cosine_ops) WITH (lists = '1');

SELECT
cron.schedule('regenerate_embedding_indices_for_chunks', '30 5 * * *', $$
SELECT
* FROM regenerate_embedding_indices_for_chunks() $$);

SELECT
cron.schedule('regenerate_embedding_indices_for_summaries', '30 5 * * *', $$
SELECT
* FROM regenerate_embedding_indices_for_summaries() $$);

0 comments on commit 7e59e67

Please sign in to comment.