1
0
mirror of https://github.com/bitwarden/server synced 2025-12-24 04:03:25 +00:00
Files
server/src/Sql/PostgreSQL/Tables/collection.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

20 lines
654 B
SQL

DROP TABLE IF EXISTS collection;
CREATE TABLE IF NOT EXISTS collection (
id UUID NOT NULL,
organization_id UUID NOT NULL,
name TEXT NOT NULL,
external_id VARCHAR (300) NULL,
creation_date TIMESTAMPTZ NOT NULL,
revision_date TIMESTAMPTZ NOT NULL,
CONSTRAINT pk_collection PRIMARY KEY (id),
CONSTRAINT fk_collection_organization FOREIGN KEY (organization_id) REFERENCES organization (id) ON DELETE CASCADE
);
CREATE INDEX ix_collection_organization_id_include_all
ON collection(organization_id ASC)
INCLUDE(creation_date, name, revision_date);