This commit is contained in:
xfarrow 2023-10-12 12:23:18 +02:00
parent 711e6d210a
commit e36091bb05
6 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,13 @@
-- Database: Blink
-- DROP DATABASE IF EXISTS "Blink";
CREATE DATABASE "Blink"
WITH
OWNER = pg_database_owner
ENCODING = 'UTF8'
LC_COLLATE = 'Italian_Italy.1252'
LC_CTYPE = 'Italian_Italy.1252'
TABLESPACE = pg_default
CONNECTION LIMIT = -1
IS_TEMPLATE = False;

View File

@ -0,0 +1,21 @@
-- Table: public.Person
-- DROP TABLE IF EXISTS public."Person";
CREATE TABLE IF NOT EXISTS public."Person"
(
id integer NOT NULL DEFAULT nextval('"Person_id_seq"'::regclass),
email character varying(128) COLLATE pg_catalog."default" NOT NULL,
password character varying(128) COLLATE pg_catalog."default" NOT NULL,
displayname character varying(128) COLLATE pg_catalog."default" NOT NULL,
date_of_birth date,
available boolean,
enabled boolean NOT NULL DEFAULT false,
place_of_living character varying(128) COLLATE pg_catalog."default",
CONSTRAINT "Person_pkey" PRIMARY KEY (id)
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public."Person"
OWNER to pg_database_owner;

View File

@ -0,0 +1,19 @@
-- Table: public.ActivationLink
-- DROP TABLE IF EXISTS public."ActivationLink";
CREATE TABLE IF NOT EXISTS public."ActivationLink"
(
identifier character varying COLLATE pg_catalog."default" NOT NULL,
person_id integer NOT NULL,
CONSTRAINT "ActivationLink_pkey" PRIMARY KEY (identifier),
CONSTRAINT "PersonActivationLinkFK" FOREIGN KEY (person_id)
REFERENCES public."Person" (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public."ActivationLink"
OWNER to pg_database_owner;

View File

@ -0,0 +1,18 @@
-- Table: public.Organization
-- DROP TABLE IF EXISTS public."Organization";
CREATE TABLE IF NOT EXISTS public."Organization"
(
id integer NOT NULL DEFAULT nextval('"Organization_id_seq"'::regclass),
name character varying(128) COLLATE pg_catalog."default" NOT NULL,
location character varying COLLATE pg_catalog."default",
description text COLLATE pg_catalog."default",
is_hiring boolean,
CONSTRAINT "Organization_pkey" PRIMARY KEY (id)
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public."Organization"
OWNER to pg_database_owner;

View File

@ -0,0 +1,21 @@
-- Table: public.OrganizationPost
-- DROP TABLE IF EXISTS public."OrganizationPost";
CREATE TABLE IF NOT EXISTS public."OrganizationPost"
(
id integer NOT NULL DEFAULT nextval('"OrganizationPost_id_seq"'::regclass),
organization_id integer NOT NULL,
content text COLLATE pg_catalog."default" NOT NULL,
CONSTRAINT "OrganizationPost_pkey" PRIMARY KEY (id),
CONSTRAINT "OrganizationIdFk" FOREIGN KEY (organization_id)
REFERENCES public."Organization" (id) MATCH SIMPLE
ON UPDATE CASCADE
ON DELETE CASCADE
NOT VALID
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public."OrganizationPost"
OWNER to postgres;

View File

@ -0,0 +1,24 @@
-- Table: public.OrganizationAdministrator
-- DROP TABLE IF EXISTS public."OrganizationAdministrator";
CREATE TABLE IF NOT EXISTS public."OrganizationAdministrator"
(
id_person integer NOT NULL,
id_organization integer NOT NULL,
CONSTRAINT "OrganizationAdministrator_pkey" PRIMARY KEY (id_organization, id_person),
CONSTRAINT "OrganizationAdministratorOrganizationId" FOREIGN KEY (id_organization)
REFERENCES public."Organization" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID,
CONSTRAINT "OrganizationAdministratorUserId" FOREIGN KEY (id_person)
REFERENCES public."Person" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public."OrganizationAdministrator"
OWNER to pg_database_owner;