Skip to content

Commit

Permalink
chore: tidy up db scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
SiTaggart committed Oct 1, 2023
1 parent 085e1c2 commit ec7aa41
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 67 deletions.
28 changes: 27 additions & 1 deletion apps/backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,34 @@ Uses Supabase. You need docker running locally to start local dev. You only need

## Handy scripts:

Note: all scripts assume the backend directory is the current working directory.

Generating migrations when you've edited the DB in the console.

```
supabase db diff --use-migra name_of_migration -f name_of_migration
yarn supabase db diff --use-migra name_of_migration -f name_of_migration
```

Reset db after migration to test migration files

```
yarn supabase db reset
```

Link local to upstream project so you can push migrations to staging or prod projects

```
yarn supabase link --project-ref $PROJECT_REF
```

Push migrations to upstream / clooud project such as staging

```
yarn supabase db push
```

Generate db types after migrations (from root of monorepo)

```
yarn generate:db-types
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
drop function if exists "public"."match_page_sections_v2"(embedding vector, match_threshold double precision, match_count integer, min_content_length integer);

drop function if exists "public"."match_page_sections_v2"(embedding vector, match_threshold double precision, min_content_length integer);

drop function if exists "public"."match_page_sections_v3"(embedding vector, match_threshold double precision, min_content_length integer);


84 changes: 18 additions & 66 deletions apps/backend/supabase/schema.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,72 +189,24 @@ export interface Database {
similarity: number
}[]
}
match_page_sections_v2:
| {
Args: {
embedding: string
match_threshold: number
match_count: number
min_content_length: number
}
Returns: {
path: string
content: string
similarity: number
}[]
}
| {
Args: {
embedding: string
match_threshold: number
min_content_length: number
}
Returns: {
content: string | null
embedding: string | null
heading: string | null
id: number
page_id: number
slug: string | null
token_count: number | null
}[]
}
match_page_sections_v3:
| {
Args: {
embedding: string
match_threshold: number
match_count: number
min_content_length: number
}
Returns: {
path: string
content: string
similarity: number
source: string
type: string
meta: Json
heading: string
slug: string
}[]
}
| {
Args: {
embedding: string
match_threshold: number
min_content_length: number
}
Returns: {
path: string
content: string
similarity: number
source: string
type: string
meta: Json
heading: string
slug: string
}[]
}
match_page_sections_v3: {
Args: {
embedding: string
match_threshold: number
match_count: number
min_content_length: number
}
Returns: {
path: string
content: string
similarity: number
source: string
type: string
meta: Json
heading: string
slug: string
}[]
}
vector_avg: {
Args: {
"": number[]
Expand Down

0 comments on commit ec7aa41

Please sign in to comment.