You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/prisma-client/prisma/migrations/20251129093846_add_updated_at_to_latest_build_virtual/migration.sql
+12-16Lines changed: 12 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,18 @@
1
1
-- Add updatedAt field to latestBuildVirtual virtual table (type definition)
2
2
-- and update both functions to include Build's updatedAt timestamp
3
3
-- Add updatedAt column to the virtual table type definition (only if it doesn't exist)
4
-
DO $$ BEGIN IF NOT EXISTS (
5
-
SELECT
6
-
1
7
-
FROM
8
-
information_schema.columns
9
-
WHERE
10
-
table_name ='latestBuildVirtual'
11
-
AND column_name ='updatedAt'
12
-
) THEN
13
-
ALTERTABLE
14
-
"latestBuildVirtual"
15
-
ADD
16
-
COLUMN "updatedAt"timestamp(3) with time zoneNOT NULL;
17
-
18
-
END IF;
19
-
4
+
DO $$
5
+
BEGIN
6
+
IF NOT EXISTS (
7
+
SELECT1
8
+
FROMinformation_schema.columns
9
+
WHERE table_schema ='public'
10
+
AND table_name ='latestBuildVirtual'
11
+
AND column_name ='updatedAt'
12
+
) THEN
13
+
ALTERTABLE"latestBuildVirtual"
14
+
ADD COLUMN "updatedAt"timestamp(3) with time zoneNOT NULL;
15
+
END IF;
20
16
END $$;
21
17
22
18
COMMENT ON COLUMN "latestBuildVirtual"."updatedAt" IS 'Timestamp indicating when the Build was last updated';
Copy file name to clipboardExpand all lines: packages/prisma-client/prisma/migrations/20251130131728_add_latest_build_virtual_for_dashboard_project/migration.sql
+28-36Lines changed: 28 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -23,40 +23,32 @@ $$ STABLE LANGUAGE sql;
23
23
COMMENT ON FUNCTION "latestBuildVirtual"("DashboardProject") IS 'Wrapper function to make latestBuildVirtual work with DashboardProject view for PostgREST computed fields.';
24
24
25
25
-- Grant execute permissions to all PostgREST roles (only if they exist)
26
-
DO $$ BEGIN-- Grant to anon if role exists
27
-
IF EXISTS (
28
-
SELECT
29
-
1
30
-
FROM
31
-
pg_roles
32
-
WHERE
33
-
rolname ='anon'
34
-
) THEN GRANT EXECUTE ON FUNCTION "latestBuildVirtual"("DashboardProject") TO anon;
35
-
36
-
END IF;
37
-
38
-
-- Grant to authenticated if role exists
39
-
IF EXISTS (
40
-
SELECT
41
-
1
42
-
FROM
43
-
pg_roles
44
-
WHERE
45
-
rolname ='authenticated'
46
-
) THEN GRANT EXECUTE ON FUNCTION "latestBuildVirtual"("DashboardProject") TO authenticated;
47
-
48
-
END IF;
49
-
50
-
-- Grant to service_role if role exists
51
-
IF EXISTS (
52
-
SELECT
53
-
1
54
-
FROM
55
-
pg_roles
56
-
WHERE
57
-
rolname ='service_role'
58
-
) THEN GRANT EXECUTE ON FUNCTION "latestBuildVirtual"("DashboardProject") TO service_role;
59
-
60
-
END IF;
61
-
26
+
DO $$
27
+
BEGIN
28
+
-- Grant to anon if role exists
29
+
IF EXISTS (
30
+
SELECT1
31
+
FROM pg_roles
32
+
WHERE rolname ='anon'
33
+
) THEN
34
+
GRANT EXECUTE ON FUNCTION "latestBuildVirtual"("DashboardProject") TO anon;
35
+
END IF;
36
+
37
+
-- Grant to authenticated if role exists
38
+
IF EXISTS (
39
+
SELECT1
40
+
FROM pg_roles
41
+
WHERE rolname ='authenticated'
42
+
) THEN
43
+
GRANT EXECUTE ON FUNCTION "latestBuildVirtual"("DashboardProject") TO authenticated;
44
+
END IF;
45
+
46
+
-- Grant to service_role if role exists
47
+
IF EXISTS (
48
+
SELECT1
49
+
FROM pg_roles
50
+
WHERE rolname ='service_role'
51
+
) THEN
52
+
GRANT EXECUTE ON FUNCTION "latestBuildVirtual"("DashboardProject") TO service_role;
0 commit comments