Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.4 KB

README.md

File metadata and controls

40 lines (31 loc) · 1.4 KB

Prepare Database

We use Supabase as the backend database service. Please follow these steps to initialize a full database structure for this project:

  1. Create Supabase project at https://supabase.io
  2. Enable PGVector by executing: CREATE EXTENSION IF NOT EXISTS vector; in SQL Editor;
  3. Copy the whole content of schema.sql and execute;
  4. Copy the content of create_user.sql and execute;
  5. Copy the content of sample_data.sql and execute;
  6. Go to Table Editor and verify the tables under schema: public;

If tables such as api_keys, chat_message etc appear correctly, please go back to README and follow the instructions to set the environment variables correctly for Supabase, both api and frontend projects depend on Supabase.

Backup

This is a reference about how to backup the table schema and data of current Supabase project:

Dump the schema to file:

pg_dump \
  --dbname="postgresql://<project-url>:<pwd>@aws-0-us-west-1.pooler.supabase.com:6543/postgres" \
  --schema=public \
  --data-only \
  --file=schema.sql

Dump the table data as INSERT statements:

pg_dump \
  --data-only \
  --table=public.tools \
  --column-inserts \
  --no-owner \
  --no-privileges \
  --file=tools.sql \
  --no-comments \
  "postgresql://<project-url>:<pwd>@aws-0-us-west-1.pooler.supabase.com:6543/postgres"