From 46229ac247ce9c997d39268c45e88b1ebfe48307 Mon Sep 17 00:00:00 2001 From: xfarrow Date: Sun, 18 Feb 2024 12:03:57 +0100 Subject: [PATCH] sql improvement --- backend/sql/1-create_person.sql | 8 ++++---- backend/sql/2-create_activation_link.sql | 2 +- backend/sql/3-create_organization.sql | 6 +++--- backend/sql/4-create_organization_post.sql | 2 +- backend/sql/6-create-message.sql | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/backend/sql/1-create_person.sql b/backend/sql/1-create_person.sql index d655581..19eab6a 100644 --- a/backend/sql/1-create_person.sql +++ b/backend/sql/1-create_person.sql @@ -5,13 +5,13 @@ CREATE TABLE IF NOT EXISTS public."Person" ( id SERIAL PRIMARY KEY, - email character varying(128) COLLATE pg_catalog."default" NOT NULL, - password character varying(128) COLLATE pg_catalog."default" NOT NULL, - display_name character varying(128) COLLATE pg_catalog."default" NOT NULL, + email character varying(128) NOT NULL UNIQUE, + password character varying(128) NOT NULL, + display_name character varying(128) NOT NULL, date_of_birth date, available boolean, 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; diff --git a/backend/sql/2-create_activation_link.sql b/backend/sql/2-create_activation_link.sql index ad10bd6..1be4584 100644 --- a/backend/sql/2-create_activation_link.sql +++ b/backend/sql/2-create_activation_link.sql @@ -4,7 +4,7 @@ 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, CONSTRAINT "PersonActivationLinkFK" FOREIGN KEY (person_id) REFERENCES public."Person" (id) MATCH SIMPLE diff --git a/backend/sql/3-create_organization.sql b/backend/sql/3-create_organization.sql index 1a97592..b46f8df 100644 --- a/backend/sql/3-create_organization.sql +++ b/backend/sql/3-create_organization.sql @@ -5,9 +5,9 @@ CREATE TABLE IF NOT EXISTS public."Organization" ( id SERIAL PRIMARY KEY, - name character varying(128) COLLATE pg_catalog."default" NOT NULL, - location character varying COLLATE pg_catalog."default", - description text COLLATE pg_catalog."default", + name character varying(128) NOT NULL, + location character varying, + description text, is_hiring boolean ) diff --git a/backend/sql/4-create_organization_post.sql b/backend/sql/4-create_organization_post.sql index 4a24677..11ea289 100644 --- a/backend/sql/4-create_organization_post.sql +++ b/backend/sql/4-create_organization_post.sql @@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS public."OrganizationPost" ( id SERIAL PRIMARY KEY, 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(), original_author integer NOT NULL, CONSTRAINT "AuthorIdFK" FOREIGN KEY (original_author) diff --git a/backend/sql/6-create-message.sql b/backend/sql/6-create-message.sql index a21494e..8291620 100644 --- a/backend/sql/6-create-message.sql +++ b/backend/sql/6-create-message.sql @@ -9,8 +9,8 @@ CREATE TABLE IF NOT EXISTS public."Message" organization_id integer NOT NULL, author_on_behalf_of_organization integer, "timestamp" timestamp without time zone NOT NULL, - content character varying(4096) COLLATE pg_catalog."default" NOT NULL, - sender_type character varying(12) COLLATE pg_catalog."default" NOT NULL, + content character varying(4096) NOT NULL, + sender_type character varying(12) NOT NULL, CONSTRAINT "Message_pkey" PRIMARY KEY (id), CONSTRAINT "Message_author_on_behalf_of_company_fkey" FOREIGN KEY (author_on_behalf_of_organization) REFERENCES public."Person" (id) MATCH SIMPLE