sql improvement

This commit is contained in:
xfarrow 2024-02-18 12:03:57 +01:00
parent a6c8450ea5
commit 46229ac247
5 changed files with 11 additions and 11 deletions

View File

@ -5,13 +5,13 @@
CREATE TABLE IF NOT EXISTS public."Person" CREATE TABLE IF NOT EXISTS public."Person"
( (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
email character varying(128) COLLATE pg_catalog."default" NOT NULL, email character varying(128) NOT NULL UNIQUE,
password character varying(128) COLLATE pg_catalog."default" NOT NULL, password character varying(128) NOT NULL,
display_name character varying(128) COLLATE pg_catalog."default" NOT NULL, display_name character varying(128) NOT NULL,
date_of_birth date, date_of_birth date,
available boolean, available boolean,
enabled boolean NOT NULL DEFAULT false, enabled boolean NOT NULL DEFAULT false,
place_of_living character varying(128) COLLATE pg_catalog."default" place_of_living character varying(128)
) )
TABLESPACE pg_default; TABLESPACE pg_default;

View File

@ -4,7 +4,7 @@
CREATE TABLE IF NOT EXISTS public."ActivationLink" CREATE TABLE IF NOT EXISTS public."ActivationLink"
( (
identifier character varying PRIMARY KEY COLLATE pg_catalog."default" , identifier character varying PRIMARY KEY,
person_id integer NOT NULL, person_id integer NOT NULL,
CONSTRAINT "PersonActivationLinkFK" FOREIGN KEY (person_id) CONSTRAINT "PersonActivationLinkFK" FOREIGN KEY (person_id)
REFERENCES public."Person" (id) MATCH SIMPLE REFERENCES public."Person" (id) MATCH SIMPLE

View File

@ -5,9 +5,9 @@
CREATE TABLE IF NOT EXISTS public."Organization" CREATE TABLE IF NOT EXISTS public."Organization"
( (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
name character varying(128) COLLATE pg_catalog."default" NOT NULL, name character varying(128) NOT NULL,
location character varying COLLATE pg_catalog."default", location character varying,
description text COLLATE pg_catalog."default", description text,
is_hiring boolean is_hiring boolean
) )

View File

@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS public."OrganizationPost"
( (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
organization_id integer NOT NULL, organization_id integer NOT NULL,
content text COLLATE pg_catalog."default" NOT NULL, content text NOT NULL,
created_at timestamp without time zone DEFAULT now(), created_at timestamp without time zone DEFAULT now(),
original_author integer NOT NULL, original_author integer NOT NULL,
CONSTRAINT "AuthorIdFK" FOREIGN KEY (original_author) CONSTRAINT "AuthorIdFK" FOREIGN KEY (original_author)

View File

@ -9,8 +9,8 @@ CREATE TABLE IF NOT EXISTS public."Message"
organization_id integer NOT NULL, organization_id integer NOT NULL,
author_on_behalf_of_organization integer, author_on_behalf_of_organization integer,
"timestamp" timestamp without time zone NOT NULL, "timestamp" timestamp without time zone NOT NULL,
content character varying(4096) COLLATE pg_catalog."default" NOT NULL, content character varying(4096) NOT NULL,
sender_type character varying(12) COLLATE pg_catalog."default" NOT NULL, sender_type character varying(12) NOT NULL,
CONSTRAINT "Message_pkey" PRIMARY KEY (id), CONSTRAINT "Message_pkey" PRIMARY KEY (id),
CONSTRAINT "Message_author_on_behalf_of_company_fkey" FOREIGN KEY (author_on_behalf_of_organization) CONSTRAINT "Message_author_on_behalf_of_company_fkey" FOREIGN KEY (author_on_behalf_of_organization)
REFERENCES public."Person" (id) MATCH SIMPLE REFERENCES public."Person" (id) MATCH SIMPLE