Skip to content

Commit 79ffda0

Browse files
Papinakspearrin
authored andcommitted
#453 PostgreSQL - Views (#560)
* PostgreSQL initial commit of translation from SQL Server to PostgreSQL * snake_case added. set search path for schema. schema qualified name no longer needed for creation and access of functions. * Table DDL for PostgreSQL * Rename User.sql to user.sql * PostgreSQL views, snake_case column fix for user_create, rename of users.sql file to lowercase
1 parent ba6baa3 commit 79ffda0

15 files changed

+110
-1
lines changed

src/Sql/PostgreSQL/Functions/user_create.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ BEGIN
4646
culture,
4747
security_stamp,
4848
two_factor_providers,
49-
two_factor_recoverycode,
49+
two_factor_recovery_code,
5050
equivalent_domains,
5151
excluded_global_equivalent_domains,
5252
account_revision_date,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE VIEW cipher_view
2+
AS
3+
SELECT
4+
*
5+
FROM
6+
cipher;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE VIEW collection_view
2+
AS
3+
SELECT
4+
*
5+
FROM
6+
collection;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE VIEW device_view
2+
AS
3+
SELECT
4+
*
5+
FROM
6+
device;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE VIEW event_view
2+
AS
3+
SELECT
4+
*
5+
FROM
6+
event;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE VIEW folder_view
2+
AS
3+
SELECT
4+
*
5+
FROM
6+
folder;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE VIEW grant_view
2+
AS
3+
SELECT
4+
*
5+
FROM
6+
"grant";
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE VIEW group_view
2+
AS
3+
SELECT
4+
*
5+
FROM
6+
"group";
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE VIEW installation_view
2+
AS
3+
SELECT
4+
*
5+
FROM
6+
installation;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
CREATE VIEW organization_user_organization_details_view
2+
AS
3+
SELECT
4+
ou.user_id,
5+
ou.organization_id,
6+
o.name,
7+
o.enabled,
8+
o.use_groups,
9+
o.use_directory,
10+
o.use_events,
11+
o.use_totp,
12+
o.use_2fa,
13+
o.use_api,
14+
o.self_host,
15+
o.users_get_premium,
16+
o.seats,
17+
o.max_collections,
18+
o.max_storage_gb,
19+
ou.key,
20+
ou.status,
21+
ou.type
22+
FROM
23+
organization_user ou
24+
INNER JOIN
25+
organization o ON o.id = ou.organization_id;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
CREATE VIEW organization_user_user_details_view
2+
AS
3+
SELECT
4+
ou.id,
5+
ou.user_id,
6+
ou.organization_id,
7+
u.name,
8+
coalesce(u.email, ou.email) email,
9+
u.two_factor_providers,
10+
u.premium,
11+
ou.status,
12+
ou.type,
13+
ou.access_all,
14+
ou.external_id
15+
FROM
16+
organization_user ou
17+
LEFT JOIN
18+
"user" u ON U.id = ou.user_id;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE VIEW organization_user_view
2+
AS
3+
SELECT
4+
*
5+
FROM
6+
organization_user;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE VIEW organization_view
2+
AS
3+
SELECT
4+
*
5+
FROM
6+
organization;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE VIEW transaction_view
2+
AS
3+
SELECT
4+
*
5+
FROM
6+
transaction;

0 commit comments

Comments
 (0)