Add map community reactions, comments, and moderation
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 3m22s
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 3m22s
This commit is contained in:
24
scripts/test-community-sql.mjs
Normal file
24
scripts/test-community-sql.mjs
Normal file
@@ -0,0 +1,24 @@
|
||||
// Uses the same optional isolated Postgres runtime as test-moderation-sql.mjs.
|
||||
import { readFile, readdir } from "node:fs/promises";
|
||||
import { PGlite } from "../.data/sql-verification/node_modules/@electric-sql/pglite/dist/index.js";
|
||||
|
||||
const db = new PGlite();
|
||||
try {
|
||||
await db.exec(`create role anon; create role authenticated; create role service_role bypassrls;
|
||||
create schema auth; create table auth.users(id uuid primary key);
|
||||
create function auth.uid() returns uuid language sql as $$ select null::uuid $$;
|
||||
create schema storage;
|
||||
create table storage.buckets(id text primary key,name text,public boolean,file_size_limit bigint,allowed_mime_types text[]);
|
||||
create table storage.objects(id uuid primary key default gen_random_uuid(),bucket_id text,name text);
|
||||
create function storage.foldername(name text) returns text[] language sql as $$ select string_to_array(name, '/') $$;`);
|
||||
for (const file of (await readdir("supabase/migrations")).filter((f) => f.endsWith(".sql")).sort()) {
|
||||
await db.exec(await readFile(`supabase/migrations/${file}`, "utf8"));
|
||||
}
|
||||
await db.exec(await readFile("tests/sql/community.sql", "utf8"));
|
||||
console.log("Community SQL passed: reactions, comments, reports, constraints, deletion, and service-only privileges.");
|
||||
} catch (error) {
|
||||
console.error(error.message);
|
||||
process.exitCode = 1;
|
||||
} finally {
|
||||
await db.close();
|
||||
}
|
||||
Reference in New Issue
Block a user