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/deparser/__tests__/pretty/__snapshots__/create-policy-pretty.test.ts.snap
+20-20Lines changed: 20 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,20 @@
1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
-
exports[`should format create_policy-1: pretty/create_policy-1.sql (non-pretty) 1`] =`"CREATE POLICY "user_policy" ON users AS PERMISSIVE FOR ALL TO authenticated_users USING (user_id = current_user_id())"`;
3
+
exports[`non-pretty: pretty/create_policy-1.sql 1`] =`"CREATE POLICY "user_policy" ON users AS PERMISSIVE FOR ALL TO authenticated_users USING (user_id = current_user_id())"`;
4
4
5
-
exports[`should format create_policy-1: pretty/create_policy-1.sql (pretty) 1`] =`
5
+
exports[`non-pretty: pretty/create_policy-2.sql 1`] =`"CREATE POLICY "admin_policy" ON sensitive_data AS RESTRICTIVE FOR SELECT TO admin_role USING (department = current_user_department()) WITH CHECK (approved = true)"`;
6
+
7
+
exports[`non-pretty: pretty/create_policy-3.sql 1`] =`"CREATE POLICY "complex_policy" ON documents AS PERMISSIVE FOR UPDATE TO document_editors USING (owner_id = current_user_id() OR (shared = true AND permissions @> '{"edit": true}')) WITH CHECK (status <> 'archived' AND last_modified > (now() - '1 day'::interval))"`;
8
+
9
+
exports[`non-pretty: pretty/create_policy-4.sql 1`] =`"CREATE POLICY "simple_policy" ON posts AS PERMISSIVE FOR SELECT TO PUBLIC USING (published = true)"`;
10
+
11
+
exports[`non-pretty: pretty/create_policy-5.sql 1`] =`"CREATE POLICY "simple_policy" ON posts AS PERMISSIVE FOR SELECT TO PUBLIC USING (published = true)"`;
12
+
13
+
exports[`non-pretty: pretty/create_policy-6.sql 1`] =`"CREATE POLICY "Simple Policy" ON posts AS PERMISSIVE FOR SELECT TO PUBLIC USING (published = true)"`;
14
+
15
+
exports[`non-pretty: pretty/create_policy-7.sql 1`] =`"CREATE POLICY "simplepolicy" ON posts AS PERMISSIVE FOR SELECT TO PUBLIC USING (published = true)"`;
@@ -13,9 +25,7 @@ exports[`should format create_policy-1: pretty/create_policy-1.sql (pretty) 1`]
13
25
)"
14
26
`;
15
27
16
-
exports[`should format create_policy-2: pretty/create_policy-2.sql (non-pretty) 1`] =`"CREATE POLICY "admin_policy" ON sensitive_data AS RESTRICTIVE FOR SELECT TO admin_role USING (department = current_user_department()) WITH CHECK (approved = true)"`;
17
-
18
-
exports[`should format create_policy-2: pretty/create_policy-2.sql (pretty) 1`] =`
@@ -29,9 +39,7 @@ exports[`should format create_policy-2: pretty/create_policy-2.sql (pretty) 1`]
29
39
)"
30
40
`;
31
41
32
-
exports[`should format create_policy-3: pretty/create_policy-3.sql (non-pretty) 1`] =`"CREATE POLICY "complex_policy" ON documents AS PERMISSIVE FOR UPDATE TO document_editors USING (owner_id = current_user_id() OR (shared = true AND permissions @> '{"edit": true}')) WITH CHECK (status <> 'archived' AND last_modified > (now() - '1 day'::interval))"`;
33
-
34
-
exports[`should format create_policy-3: pretty/create_policy-3.sql (pretty) 1`] =`
@@ -48,9 +56,7 @@ exports[`should format create_policy-3: pretty/create_policy-3.sql (pretty) 1`]
48
56
)"
49
57
`;
50
58
51
-
exports[`should format create_policy-4: pretty/create_policy-4.sql (non-pretty) 1`] =`"CREATE POLICY "simple_policy" ON posts AS PERMISSIVE FOR SELECT TO PUBLIC USING (published = true)"`;
52
-
53
-
exports[`should format create_policy-4: pretty/create_policy-4.sql (pretty) 1`] =`
@@ -61,9 +67,7 @@ exports[`should format create_policy-4: pretty/create_policy-4.sql (pretty) 1`]
61
67
)"
62
68
`;
63
69
64
-
exports[`should format create_policy-5: pretty/create_policy-5.sql (non-pretty) 1`] =`"CREATE POLICY "simple_policy" ON posts AS PERMISSIVE FOR SELECT TO PUBLIC USING (published = true)"`;
65
-
66
-
exports[`should format create_policy-5: pretty/create_policy-5.sql (pretty) 1`] =`
@@ -74,9 +78,7 @@ exports[`should format create_policy-5: pretty/create_policy-5.sql (pretty) 1`]
74
78
)"
75
79
`;
76
80
77
-
exports[`should format create_policy-6: pretty/create_policy-6.sql (non-pretty) 1`] =`"CREATE POLICY "Simple Policy" ON posts AS PERMISSIVE FOR SELECT TO PUBLIC USING (published = true)"`;
78
-
79
-
exports[`should format create_policy-6: pretty/create_policy-6.sql (pretty) 1`] =`
@@ -87,9 +89,7 @@ exports[`should format create_policy-6: pretty/create_policy-6.sql (pretty) 1`]
87
89
)"
88
90
`;
89
91
90
-
exports[`should format create_policy-7: pretty/create_policy-7.sql (non-pretty) 1`] =`"CREATE POLICY "simplepolicy" ON posts AS PERMISSIVE FOR SELECT TO PUBLIC USING (published = true)"`;
91
-
92
-
exports[`should format create_policy-7: pretty/create_policy-7.sql (pretty) 1`] =`
Copy file name to clipboardExpand all lines: packages/deparser/__tests__/pretty/__snapshots__/create-table-pretty.test.ts.snap
+17-17Lines changed: 17 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,26 @@
1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
-
exports[`should format create_table-1: pretty/create_table-1.sql (non-pretty) 1`] =`"CREATE TABLE users (id serial PRIMARY KEY, name text NOT NULL, email text UNIQUE)"`;
3
+
exports[`non-pretty: pretty/create_table-1.sql 1`] =`"CREATE TABLE users (id serial PRIMARY KEY, name text NOT NULL, email text UNIQUE)"`;
4
4
5
-
exports[`should format create_table-1: pretty/create_table-1.sql (pretty) 1`] =`
5
+
exports[`non-pretty: pretty/create_table-2.sql 1`] =`"CREATE TABLE products (id serial PRIMARY KEY, name varchar(255) NOT NULL, price numeric(10, 2) CHECK (price > 0), category_id int, description text, created_at pg_catalog.timestamp DEFAULT now(), updated_at pg_catalog.timestamp, UNIQUE (name, category_id), FOREIGN KEY (category_id) REFERENCES categories (id))"`;
6
+
7
+
exports[`non-pretty: pretty/create_table-3.sql 1`] =`"CREATE TABLE orders (id serial PRIMARY KEY, subtotal numeric(10, 2) NOT NULL, tax_rate numeric(5, 4) DEFAULT 0.0825, tax_amount numeric(10, 2) GENERATED ALWAYS AS (subtotal * tax_rate) STORED, total numeric(10, 2) GENERATED ALWAYS AS (subtotal + tax_amount) STORED)"`;
8
+
9
+
exports[`non-pretty: pretty/create_table-4.sql 1`] =`"CREATE TABLE sales (id serial, sale_date date NOT NULL, amount numeric(10, 2), region varchar(50)) PARTITION BY RANGE (sale_date)"`;
10
+
11
+
exports[`non-pretty: pretty/create_table-5.sql 1`] =`"CREATE TEMPORARY TABLE temp_calculations (id int, value numeric(15, 5), result text)"`;
12
+
13
+
exports[`non-pretty: pretty/create_table-6.sql 1`] =`"CREATE TABLE orders (id serial PRIMARY KEY, user_id int NOT NULL, total numeric(10, 2) CHECK (total > 0), status varchar(20) DEFAULT 'pending', created_at pg_catalog.timestamp DEFAULT now(), FOREIGN KEY (user_id) REFERENCES users (id))"`;
14
+
15
+
exports[`pretty: pretty/create_table-1.sql 1`] =`
6
16
"CREATE TABLE users (
7
17
id serial PRIMARY KEY,
8
18
name text NOT NULL,
9
19
email text UNIQUE
10
20
)"
11
21
`;
12
22
13
-
exports[`should format create_table-2: pretty/create_table-2.sql (non-pretty) 1`] =`"CREATE TABLE products (id serial PRIMARY KEY, name varchar(255) NOT NULL, price numeric(10, 2) CHECK (price > 0), category_id int, description text, created_at pg_catalog.timestamp DEFAULT now(), updated_at pg_catalog.timestamp, UNIQUE (name, category_id), FOREIGN KEY (category_id) REFERENCES categories (id))"`;
14
-
15
-
exports[`should format create_table-2: pretty/create_table-2.sql (pretty) 1`] =`
exports[`should format create_table-4: pretty/create_table-4.sql (non-pretty) 1`] =`"CREATE TABLE sales (id serial, sale_date date NOT NULL, amount numeric(10, 2), region varchar(50)) PARTITION BY RANGE (sale_date)"`;
42
-
43
-
exports[`should format create_table-4: pretty/create_table-4.sql (pretty) 1`] =`
exports[`should format create_table-5: pretty/create_table-5.sql (non-pretty) 1`] =`"CREATE TEMPORARY TABLE temp_calculations (id int, value numeric(15, 5), result text)"`;
53
-
54
-
exports[`should format create_table-5: pretty/create_table-5.sql (pretty) 1`] =`
56
+
exports[`pretty: pretty/create_table-5.sql 1`] =`
55
57
"CREATE TEMPORARY TABLE temp_calculations (
56
58
id int,
57
59
value numeric(15, 5),
58
60
result text
59
61
)"
60
62
`;
61
63
62
-
exports[`should format create_table-6: pretty/create_table-6.sql (non-pretty) 1`] =`"CREATE TABLE orders (id serial PRIMARY KEY, user_id int NOT NULL, total numeric(10, 2) CHECK (total > 0), status varchar(20) DEFAULT 'pending', created_at pg_catalog.timestamp DEFAULT now(), FOREIGN KEY (user_id) REFERENCES users (id))"`;
63
-
64
-
exports[`should format create_table-6: pretty/create_table-6.sql (pretty) 1`] =`
Copy file name to clipboardExpand all lines: packages/deparser/__tests__/pretty/__snapshots__/cte-pretty.test.ts.snap
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,14 @@
1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
-
exports[`should format cte-1: pretty/cte-1.sql (non-pretty) 1`] =`"WITH regional_sales AS (SELECT region, sum(sales_amount) AS total_sales FROM sales GROUP BY region) SELECT * FROM regional_sales"`;
3
+
exports[`non-pretty: pretty/cte-1.sql 1`] =`"WITH regional_sales AS (SELECT region, sum(sales_amount) AS total_sales FROM sales GROUP BY region) SELECT * FROM regional_sales"`;
4
4
5
-
exports[`should format cte-1: pretty/cte-1.sql (pretty) 1`] =`
5
+
exports[`non-pretty: pretty/cte-2.sql 1`] =`"WITH regional_sales AS (SELECT region, sum(sales_amount) AS total_sales FROM sales GROUP BY region), top_regions AS (SELECT region FROM regional_sales WHERE total_sales > 1000000) SELECT * FROM top_regions"`;
6
+
7
+
exports[`non-pretty: pretty/cte-3.sql 1`] =`"WITH RECURSIVE employee_hierarchy AS (SELECT id, name, manager_id, 1 AS level FROM employees WHERE manager_id IS NULL UNION ALL SELECT e.id, e.name, e.manager_id, eh.level + 1 FROM employees AS e JOIN employee_hierarchy AS eh ON e.manager_id = eh.id) SELECT * FROM employee_hierarchy"`;
8
+
9
+
exports[`non-pretty: pretty/cte-4.sql 1`] =`"WITH sales_summary AS (SELECT region, product_category, sum(amount) AS total FROM sales GROUP BY region, product_category), regional_totals AS (SELECT region, sum(total) AS region_total FROM sales_summary GROUP BY region) SELECT s.region, s.product_category, s.total, r.region_total FROM sales_summary AS s JOIN regional_totals AS r ON s.region = r.region"`;
10
+
11
+
exports[`pretty: pretty/cte-1.sql 1`] =`
6
12
"WITH
7
13
regional_sales AS (SELECT
8
14
region,
@@ -14,9 +20,7 @@ SELECT *
14
20
FROM regional_sales"
15
21
`;
16
22
17
-
exports[`should format cte-2: pretty/cte-2.sql (non-pretty) 1`] =`"WITH regional_sales AS (SELECT region, sum(sales_amount) AS total_sales FROM sales GROUP BY region), top_regions AS (SELECT region FROM regional_sales WHERE total_sales > 1000000) SELECT * FROM top_regions"`;
18
-
19
-
exports[`should format cte-2: pretty/cte-2.sql (pretty) 1`] =`
23
+
exports[`pretty: pretty/cte-2.sql 1`] =`
20
24
"WITH
21
25
regional_sales AS (SELECT
22
26
region,
@@ -32,9 +36,7 @@ SELECT *
32
36
FROM top_regions"
33
37
`;
34
38
35
-
exports[`should format cte-3: pretty/cte-3.sql (non-pretty) 1`] =`"WITH RECURSIVE employee_hierarchy AS (SELECT id, name, manager_id, 1 AS level FROM employees WHERE manager_id IS NULL UNION ALL SELECT e.id, e.name, e.manager_id, eh.level + 1 FROM employees AS e JOIN employee_hierarchy AS eh ON e.manager_id = eh.id) SELECT * FROM employee_hierarchy"`;
36
-
37
-
exports[`should format cte-3: pretty/cte-3.sql (pretty) 1`] =`
39
+
exports[`pretty: pretty/cte-3.sql 1`] =`
38
40
"WITH RECURSIVE
39
41
employee_hierarchy AS (SELECT
40
42
id,
@@ -57,9 +59,7 @@ SELECT *
57
59
FROM employee_hierarchy"
58
60
`;
59
61
60
-
exports[`should format cte-4: pretty/cte-4.sql (non-pretty) 1`] =`"WITH sales_summary AS (SELECT region, product_category, sum(amount) AS total FROM sales GROUP BY region, product_category), regional_totals AS (SELECT region, sum(total) AS region_total FROM sales_summary GROUP BY region) SELECT s.region, s.product_category, s.total, r.region_total FROM sales_summary AS s JOIN regional_totals AS r ON s.region = r.region"`;
61
-
62
-
exports[`should format cte-4: pretty/cte-4.sql (pretty) 1`] =`
0 commit comments