-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): adds migration for tracking vector store indexing status (#…
…830) * Enables Supabase realtime for the vector_store_file table * Adds new Python dependency to test supabase-realtime * Status is currently being set during indexing so listening to this table should provide status updates on the file indexing process.
- Loading branch information
1 parent
8a1d61e
commit eee3ed7
Showing
5 changed files
with
189 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/api/supabase/migrations/20240827103100_v0.11.1_indexing_status.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
-- Update the vector_store_file table to add an updated_at column | ||
ALTER TABLE vector_store_file ADD COLUMN updated_at timestamp DEFAULT timezone('utc', now()) NOT NULL; | ||
|
||
-- Add an index on user_id for faster queries | ||
CREATE INDEX idx_vector_store_file_user_id ON vector_store_file(user_id); | ||
|
||
-- Create a function to update the updated_at column | ||
CREATE OR REPLACE FUNCTION update_modified_column() | ||
RETURNS TRIGGER AS $$ | ||
BEGIN | ||
NEW.updated_at = timezone('utc', now()); | ||
RETURN NEW; | ||
END; | ||
$$ language 'plpgsql'; | ||
|
||
-- Create a trigger to automatically update the updated_at column | ||
CREATE TRIGGER update_vector_store_file_modtime | ||
BEFORE UPDATE ON vector_store_file | ||
FOR EACH ROW | ||
EXECUTE FUNCTION update_modified_column(); | ||
|
||
-- Enable Supabase realtime for the vector_store_file table | ||
alter publication supabase_realtime | ||
add table vector_store_file; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ | |
import requests | ||
|
||
# This is the anon_key for supabase, it provides access to the endpoints that would otherwise be inaccessible | ||
ANON_KEY = os.getenv("ANON_KEY") | ||
ANON_KEY = os.environ["ANON_KEY"] | ||
SERVICE_KEY = os.environ["SERVICE_KEY"] | ||
DEFAULT_TEST_EMAIL = "[email protected]" | ||
DEFAULT_TEST_PASSWORD = "password" | ||
|
||
|