Files
Oleg Isonen d15c8702da fix: fix db tests (#5473)
## Description

1. What is this PR about (link the issue and add a short description)

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
0000)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
2025-12-03 22:22:15 +01:00
..
2025-12-03 22:22:15 +01:00

Postgrest

Postgrest-js

postgrest-js best doc

Generated Types

pnpm generate-types

or in case of non devcontainer environment

docker compose exec -iT app bash
cd /workspaces/webstudio/packages/postgrest
pnpm generate-types

Playground

pnpm playground ./playground/{file}.ts
# OR
pnpm tsx --env-file ../../apps/builder/.env ./playground/{file}.ts

Next steps.

Use https://supabase.com/docs/reference/cli/supabase-db-start or directly https://github.com/djrobstep/migra for migrations.

Supabase can be used with --db-url flag to not reproduce "local" env

Sql testing

CREATE SCHEMA IF NOT EXISTS pgtap;
DROP EXTENSION pgtap;
CREATE EXTENSION IF NOT EXISTS pgtap WITH SCHEMA pgtap;
pnpx supabase test new latest-builds
docker run --rm --network host -v ./supabase/tests:/tests -e PGOPTIONS='--search_path=pgtap,public' supabase/pg_prove:3.36 pg_prove -d "postgresql://postgres:pass@localhost/webstudio" --ext .sql /tests
# OR
pnpm run db-test