1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-29 23:34:53 -05:00
bitwarden/src/Sql/PostgreSQL/Tables/collection_user.sql
Papina 5000de6fa8 #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
2019-09-11 13:38:46 -04:00

12 lines
537 B
SQL

DROP TABLE IF EXISTS collection_user;
CREATE TABLE IF NOT EXISTS collection_user (
collection_id UUID NOT NULL,
organization_user_id UUID NOT NULL,
read_only BIT NOT NULL,
CONSTRAINT pk_collection_user PRIMARY KEY (collection_id, organization_user_id),
CONSTRAINT fk_collection_user_collection FOREIGN KEY (collection_id) REFERENCES collection (id) ON DELETE CASCADE,
CONSTRAINT fk_collection_user_organization_user FOREIGN KEY (organization_user_id) REFERENCES organization_user (id)
);