-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
4,023 additions
and
1,058 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,16 +56,13 @@ jobs: | |
SERVICE_KEY: ${{ secrets.SERVICE_KEY }} | ||
TENANT_ID: ${{ secrets.TENANT_ID }} | ||
REGION: ${{ secrets.REGION }} | ||
POSTGREST_URL: ${{ secrets.POSTGREST_URL }} | ||
GLOBAL_S3_BUCKET: ${{ secrets.GLOBAL_S3_BUCKET }} | ||
PGRST_JWT_SECRET: ${{ secrets.PGRST_JWT_SECRET }} | ||
AUTHENTICATED_KEY: ${{ secrets.AUTHENTICATED_KEY }} | ||
DATABASE_URL: postgresql://postgres:[email protected]/postgres | ||
PGOPTIONS: -c search_path=storage,public | ||
FILE_SIZE_LIMIT: '52428800' | ||
STORAGE_BACKEND: s3 | ||
MULTITENANT_DATABASE_URL: postgresql://postgres:[email protected]:5433/postgres | ||
POSTGREST_URL_SUFFIX: /rest/v1 | ||
ADMIN_API_KEYS: apikey | ||
ENABLE_IMAGE_TRANSFORMATION: true | ||
IMGPROXY_URL: http://127.0.0.1:50020 | ||
|
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { getConfig, setEnvPaths } from './src/config' | ||
|
||
setEnvPaths(['.env.test', '.env']) | ||
|
||
beforeEach(() => { | ||
getConfig({ reload: true }) | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
|
||
CREATE OR REPLACE FUNCTION storage.list_objects_with_delimiter(bucket_id text, prefix_param text, delimiter_param text, max_keys integer default 100, next_token text DEFAULT '') | ||
RETURNS TABLE (name text, id uuid, metadata jsonb, updated_at timestamptz) AS | ||
$$ | ||
BEGIN | ||
RETURN QUERY EXECUTE | ||
'SELECT DISTINCT ON(name COLLATE "C") * from ( | ||
SELECT | ||
CASE | ||
WHEN position($2 IN substring(name from length($1) + 1)) > 0 THEN | ||
substring(name from 1 for length($1) + position($2 IN substring(name from length($1) + 1))) | ||
ELSE | ||
name | ||
END AS name, id, metadata, updated_at | ||
FROM | ||
storage.objects | ||
WHERE | ||
bucket_id = $5 AND | ||
name ILIKE $1 || ''%'' AND | ||
CASE | ||
WHEN $4 != '''' THEN | ||
CASE | ||
WHEN position($2 IN substring(name from length($1) + 1)) > 0 THEN | ||
substring(name from 1 for length($1) + position($2 IN substring(name from length($1) + 1))) COLLATE "C" > $4 | ||
ELSE | ||
name COLLATE "C" > $4 | ||
END | ||
ELSE | ||
true | ||
END | ||
ORDER BY | ||
name COLLATE "C" ASC) as e order by name COLLATE "C" LIMIT $3' | ||
USING prefix_param, delimiter_param, max_keys, next_token, bucket_id; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
|
||
CREATE INDEX idx_objects_bucket_id_name | ||
ON storage.objects (bucket_id, (name COLLATE "C")); |
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,66 @@ | ||
|
||
CREATE TABLE IF NOT EXISTS storage._s3_multipart_uploads ( | ||
id text PRIMARY KEY, | ||
in_progress_size int NOT NULL default 0, | ||
upload_signature text NOT NULL, | ||
bucket_id text NOT NULL references storage.buckets(id), | ||
key text COLLATE "C" NOT NULL , | ||
version text NOT NULL, | ||
created_at timestamptz NOT NULL default now() | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS storage._s3_multipart_uploads_parts ( | ||
id uuid PRIMARY KEY default gen_random_uuid(), | ||
upload_id text NOT NULL references storage._s3_multipart_uploads(id) ON DELETE CASCADE, | ||
size int NOT NULL default 0, | ||
part_number int NOT NULL, | ||
bucket_id text NOT NULL references storage.buckets(id), | ||
key text COLLATE "C" NOT NULL, | ||
etag text NOT NULL, | ||
version text NOT NULL, | ||
created_at timestamptz NOT NULL default now() | ||
); | ||
|
||
CREATE INDEX idx_multipart_uploads_list | ||
ON storage._s3_multipart_uploads (bucket_id, (key COLLATE "C"), created_at ASC); | ||
|
||
CREATE OR REPLACE FUNCTION storage.list_multipart_uploads_with_delimiter(bucket_id text, prefix_param text, delimiter_param text, max_keys integer default 100, next_key_token text DEFAULT '', next_upload_token text default '') | ||
RETURNS TABLE (key text, id text, created_at timestamptz) AS | ||
$$ | ||
BEGIN | ||
RETURN QUERY EXECUTE | ||
'SELECT DISTINCT ON(key COLLATE "C") * from ( | ||
SELECT | ||
CASE | ||
WHEN position($2 IN substring(key from length($1) + 1)) > 0 THEN | ||
substring(key from 1 for length($1) + position($2 IN substring(key from length($1) + 1))) | ||
ELSE | ||
key | ||
END AS key, id, created_at | ||
FROM | ||
storage._s3_multipart_uploads | ||
WHERE | ||
bucket_id = $5 AND | ||
key ILIKE $1 || ''%'' AND | ||
CASE | ||
WHEN $4 != '''' AND $6 = '''' THEN | ||
CASE | ||
WHEN position($2 IN substring(key from length($1) + 1)) > 0 THEN | ||
substring(key from 1 for length($1) + position($2 IN substring(key from length($1) + 1))) COLLATE "C" > $4 | ||
ELSE | ||
key COLLATE "C" > $4 | ||
END | ||
ELSE | ||
true | ||
END AND | ||
CASE | ||
WHEN $6 != '''' THEN | ||
id COLLATE "C" > $6 | ||
ELSE | ||
true | ||
END | ||
ORDER BY | ||
key COLLATE "C" ASC, created_at ASC) as e order by key COLLATE "C" LIMIT $3' | ||
USING prefix_param, delimiter_param, max_keys, next_key_token, bucket_id, next_upload_token; | ||
END; | ||
$$ LANGUAGE plpgsql; |
Oops, something went wrong.