Skip to content

Commit 2f393f5

Browse files
authored
fix: Fix more sql tests (#5474)
## 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
1 parent d15c870 commit 2f393f5

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
pnpm-lock.yaml
22
packages/prisma-client/prisma/migrations/*/client
33
packages/prisma-client/**/*.d.ts
4+
packages/prisma-client/prisma/migrations/**/*.sql
45
packages/postgrest/supabase/tests/*.sql

packages/prisma-client/prisma/migrations/20251129093846_add_updated_at_to_latest_build_virtual/migration.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ COMMENT ON COLUMN "latestBuildVirtual"."updatedAt" IS 'Timestamp indicating when
1010

1111
-- Recreate the function for Project with updatedAt field
1212
CREATE
13-
OR REPLACE FUNCTION "latestBuildVirtual"("Project") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $ $
13+
OR REPLACE FUNCTION "latestBuildVirtual"("Project") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $$
1414
SELECT
1515
b.id AS "buildId",
1616
b."projectId",
@@ -47,14 +47,14 @@ ORDER BY
4747
LIMIT
4848
1;
4949

50-
$ $ STABLE LANGUAGE sql;
50+
$$ STABLE LANGUAGE sql;
5151

5252
-- Comment on the function
5353
COMMENT ON FUNCTION "latestBuildVirtual"("Project") IS 'This function computes the latest build for a project, ensuring it is a production (non-static) build, where the domain matches either the Project.domain field or exists in the related Domain table. It provides backward compatibility for older records with a missing "destination" field.';
5454

5555
-- Recreate the function for domainsVirtual with updatedAt field
5656
CREATE
57-
OR REPLACE FUNCTION "latestBuildVirtual"("domainsVirtual") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $ $
57+
OR REPLACE FUNCTION "latestBuildVirtual"("domainsVirtual") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $$
5858
SELECT
5959
b.id AS "buildId",
6060
b."projectId",
@@ -75,14 +75,14 @@ ORDER BY
7575
LIMIT
7676
1;
7777

78-
$ $ STABLE LANGUAGE sql;
78+
$$ STABLE LANGUAGE sql;
7979

8080
-- Adding a comment to provide more context
8181
COMMENT ON FUNCTION "latestBuildVirtual"("domainsVirtual") IS 'Returns the latest build for a given project and domain as a computed field for PostgREST.';
8282

8383
-- Update latestProjectDomainBuildVirtual function to include updatedAt
8484
CREATE
85-
OR REPLACE FUNCTION "latestProjectDomainBuildVirtual"("Project") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $ $
85+
OR REPLACE FUNCTION "latestProjectDomainBuildVirtual"("Project") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $$
8686
SELECT
8787
b.id AS "buildId",
8888
b."projectId",
@@ -111,6 +111,6 @@ ORDER BY
111111
LIMIT
112112
1;
113113

114-
$ $ STABLE LANGUAGE sql;
114+
$$ STABLE LANGUAGE sql;
115115

116116
COMMENT ON FUNCTION "latestProjectDomainBuildVirtual"("Project") IS 'This function computes the latest build for a project domain, ensuring it is a production (non-static) build, where the domain matches either the Project.domain field or exists in the related Domain table. It provides backward compatibility for older records with a missing "destination" field.';

packages/prisma-client/prisma/migrations/20251130131728_add_latest_build_virtual_for_dashboard_project/migration.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
-- that matches the source table/view type. DashboardProject is a view
44
-- over Project, so we need this wrapper function.
55
CREATE
6-
OR REPLACE FUNCTION "latestBuildVirtual"("DashboardProject") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $ $
6+
OR REPLACE FUNCTION "latestBuildVirtual"("DashboardProject") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $$
77
SELECT
88
*
99
FROM
@@ -18,7 +18,7 @@ FROM
1818
)
1919
);
2020

21-
$ $ STABLE LANGUAGE sql;
21+
$$ STABLE LANGUAGE sql;
2222

2323
COMMENT ON FUNCTION "latestBuildVirtual"("DashboardProject") IS 'Wrapper function to make latestBuildVirtual work with DashboardProject view for PostgREST computed fields.';
2424

0 commit comments

Comments
 (0)