mirror of
https://github.com/StanGirard/quivr.git
synced 2024-08-16 16:40:40 +03:00
Add Supabase schema, migrations, and .gitignore file
This commit is contained in:
parent
74c0e2d72c
commit
b3e8c3d711
@ -80,10 +80,11 @@ You can find the installation video [here](https://www.youtube.com/watch?v=cXBa6
|
||||
- **Step 4**: Launch the project
|
||||
|
||||
```bash
|
||||
supabase start
|
||||
cd backend && supabase start
|
||||
```
|
||||
and then
|
||||
```bash
|
||||
cd ../
|
||||
docker compose pull
|
||||
docker compose up
|
||||
```
|
||||
|
@ -58,9 +58,6 @@ RUN pip install --no-cache-dir --upgrade pip && \
|
||||
# Copy the rest of the application
|
||||
COPY . .
|
||||
|
||||
# COPY Supabase from ../supabase in /code/supabase
|
||||
COPY ../supabase /code/supabase
|
||||
|
||||
EXPOSE 5050
|
||||
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5050", "--workers", "6"]
|
58
backend/supabase/20240103191539_private.sql
Normal file
58
backend/supabase/20240103191539_private.sql
Normal file
@ -0,0 +1,58 @@
|
||||
CREATE EXTENSION IF NOT EXISTS wrappers;
|
||||
|
||||
-- Create foreign data wrapper 'stripe_wrapper' if it doesn't exist
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.foreign_data_wrappers
|
||||
WHERE foreign_data_wrapper_name = 'stripe_wrapper'
|
||||
) THEN
|
||||
CREATE FOREIGN DATA WRAPPER stripe_wrapper
|
||||
HANDLER stripe_fdw_handler;
|
||||
END IF;
|
||||
END $$;
|
||||
^
|
||||
-- Check if the server 'stripe_server' exists before creating it
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_foreign_server WHERE srvname = 'stripe_server') THEN
|
||||
CREATE SERVER stripe_server
|
||||
FOREIGN DATA WRAPPER stripe_wrapper
|
||||
OPTIONS (
|
||||
api_key 'pk_test_51NtDTIJglvQxkJ1HgOBKicXBZ9Ug9pIhOZz3Lkask6q5JPZRoRW49nmwW6Q7wjWHJgc89HbruUP7GJ0d5DlQYOQ200MkvXpFnV' -- Replace with your Stripe API key
|
||||
);
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- Create foreign table 'public.customers' if it doesn't exist
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.tables
|
||||
WHERE table_name = 'customers'
|
||||
) THEN
|
||||
CREATE FOREIGN TABLE public.customers (
|
||||
id text,
|
||||
email text,
|
||||
name text,
|
||||
description text,
|
||||
created timestamp,
|
||||
attrs jsonb
|
||||
)
|
||||
SERVER stripe_server
|
||||
OPTIONS (
|
||||
OBJECT 'customers',
|
||||
ROWID_COLUMN 'id'
|
||||
);
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
|
||||
create schema if not exists extensions;
|
||||
|
||||
create table if not exists
|
||||
extensions.wrappers_fdw_stats ();
|
||||
|
||||
grant all on extensions.wrappers_fdw_stats to service_role;
|
@ -56,7 +56,9 @@ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
||||
source ~/.bashrc
|
||||
nvm install 20
|
||||
nvm use 20
|
||||
cd backend
|
||||
npx supabase start
|
||||
cd ..
|
||||
```
|
||||
|
||||
11. Allow the firewall
|
||||
|
Loading…
Reference in New Issue
Block a user