1
0
mirror of https://github.com/bitwarden/server synced 2025-12-26 21:23:39 +00:00

#453 Added PostgreSQL initial db scripts (User) (#556)

* 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
This commit is contained in:
Papina
2019-09-12 03:38:46 +10:00
committed by Kyle Spearrin
parent 12c8e4b124
commit 5000de6fa8
24 changed files with 543 additions and 4 deletions

View File

@@ -0,0 +1,30 @@
DROP FUNCTION IF EXISTS user_search;
CREATE OR REPLACE FUNCTION user_search
(
_email VARCHAR(50),
_skip INT DEFAULT 0,
_take INT DEFAULT 25
)
RETURNS SETOF user_view
LANGUAGE 'plpgsql'
AS
$BODY$
DECLARE
email_like_search VARCHAR(55) = _email || '%';
BEGIN
RETURN QUERY
SELECT
*
FROM
user_view
WHERE
email IS NULL
OR
email LIKE email_like_search
ORDER BY email ASC
OFFSET _skip ROWS
FETCH NEXT _take ROWS only;
end
$BODY$