Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: Fix more sql tests (#5474)

Oleg Isonen2f393f5efe8f
diff --git a/.prettierignore b/.prettierignore
index 7a55f3b6c9..ee62e080a4 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,4 +1,5 @@
pnpm-lock.yaml
packages/prisma-client/prisma/migrations/*/client
packages/prisma-client/**/*.d.ts
+packages/prisma-client/prisma/migrations/**/*.sql
packages/postgrest/supabase/tests/*.sql
diff --git a/packages/prisma-client/prisma/migrations/20251129093846_add_updated_at_to_latest_build_virtual/migration.sql b/packages/prisma-client/prisma/migrations/20251129093846_add_updated_at_to_latest_build_virtual/migration.sql
index d055a0bdcc..66105c60d1 100644
--- a/packages/prisma-client/prisma/migrations/20251129093846_add_updated_at_to_latest_build_virtual/migration.sql
+++ b/packages/prisma-client/prisma/migrations/20251129093846_add_updated_at_to_latest_build_virtual/migration.sql
@@ -10,7 +10,7 @@ COMMENT ON COLUMN "latestBuildVirtual"."updatedAt" IS 'Timestamp indicating when
-- Recreate the function for Project with updatedAt field
CREATE
-OR REPLACE FUNCTION "latestBuildVirtual"("Project") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $ $
+OR REPLACE FUNCTION "latestBuildVirtual"("Project") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $$
SELECT
b.id AS "buildId",
b."projectId",
@@ -47,14 +47,14 @@ ORDER BY
LIMIT
1;
-$ $ STABLE LANGUAGE sql;
+$$ STABLE LANGUAGE sql;
-- Comment on the function
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.';
-- Recreate the function for domainsVirtual with updatedAt field
CREATE
-OR REPLACE FUNCTION "latestBuildVirtual"("domainsVirtual") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $ $
+OR REPLACE FUNCTION "latestBuildVirtual"("domainsVirtual") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $$
SELECT
b.id AS "buildId",
b."projectId",
@@ -75,14 +75,14 @@ ORDER BY
LIMIT
1;
-$ $ STABLE LANGUAGE sql;
+$$ STABLE LANGUAGE sql;
-- Adding a comment to provide more context
COMMENT ON FUNCTION "latestBuildVirtual"("domainsVirtual") IS 'Returns the latest build for a given project and domain as a computed field for PostgREST.';
-- Update latestProjectDomainBuildVirtual function to include updatedAt
CREATE
-OR REPLACE FUNCTION "latestProjectDomainBuildVirtual"("Project") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $ $
+OR REPLACE FUNCTION "latestProjectDomainBuildVirtual"("Project") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $$
SELECT
b.id AS "buildId",
b."projectId",
@@ -111,6 +111,6 @@ ORDER BY
LIMIT
1;
-$ $ STABLE LANGUAGE sql;
+$$ STABLE LANGUAGE sql;
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.';
\ No newline at end of file
diff --git a/packages/prisma-client/prisma/migrations/20251130131728_add_latest_build_virtual_for_dashboard_project/migration.sql b/packages/prisma-client/prisma/migrations/20251130131728_add_latest_build_virtual_for_dashboard_project/migration.sql
index f996c5d920..9f4e1f08f0 100644
--- a/packages/prisma-client/prisma/migrations/20251130131728_add_latest_build_virtual_for_dashboard_project/migration.sql
+++ b/packages/prisma-client/prisma/migrations/20251130131728_add_latest_build_virtual_for_dashboard_project/migration.sql
@@ -3,7 +3,7 @@
-- that matches the source table/view type. DashboardProject is a view
-- over Project, so we need this wrapper function.
CREATE
-OR REPLACE FUNCTION "latestBuildVirtual"("DashboardProject") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $ $
+OR REPLACE FUNCTION "latestBuildVirtual"("DashboardProject") RETURNS SETOF "latestBuildVirtual" ROWS 1 AS $$
SELECT
*
FROM
@@ -18,7 +18,7 @@ FROM
)
);
-$ $ STABLE LANGUAGE sql;
+$$ STABLE LANGUAGE sql;
COMMENT ON FUNCTION "latestBuildVirtual"("DashboardProject") IS 'Wrapper function to make latestBuildVirtual work with DashboardProject view for PostgREST computed fields.';