Lin / docu_code /My_data_base_schema_.txt
Zelyanoth's picture
fff
25f22bf
raw
history blame
2.16 kB
-- WARNING: This schema is for context only and is not meant to be run.
-- Table order and constraints may not be valid for execution.
CREATE TABLE public.Post_content (
id_social bigint,
Text_content text,
Video_content text,
post_time time without time zone,
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
created_at timestamp with time zone NOT NULL DEFAULT now(),
image_content_url bytea,
sched bigint,
is_published boolean DEFAULT false,
CONSTRAINT Post_content_pkey PRIMARY KEY (id),
CONSTRAINT Post_content_id_social_fkey FOREIGN KEY (id_social) REFERENCES public.Social_network(id),
CONSTRAINT Post_content_sched_fkey FOREIGN KEY (sched) REFERENCES public.Scheduling(id)
);
CREATE TABLE public.Scheduling (
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
id_social bigint,
created_at timestamp with time zone NOT NULL DEFAULT now(),
schedule_time character varying,
adjusted_time character varying NOT NULL,
CONSTRAINT Scheduling_pkey PRIMARY KEY (id),
CONSTRAINT Scheduling_id_social_fkey FOREIGN KEY (id_social) REFERENCES public.Social_network(id)
);
CREATE TABLE public.Social_network (
id_utilisateur uuid DEFAULT gen_random_uuid(),
created_at timestamp with time zone NOT NULL DEFAULT now(),
social_network character varying NOT NULL,
token character varying NOT NULL UNIQUE,
sub character varying NOT NULL UNIQUE,
given_name character varying NOT NULL,
picture character varying NOT NULL,
family_name character varying NOT NULL,
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
account_name text NOT NULL UNIQUE,
CONSTRAINT Social_network_pkey PRIMARY KEY (id),
CONSTRAINT Social_network_id_utilisateur_fkey FOREIGN KEY (id_utilisateur) REFERENCES auth.users(id)
);
CREATE TABLE public.Source (
source text NOT NULL,
categorie text,
last_update timestamp without time zone DEFAULT now(),
created_at timestamp with time zone NOT NULL DEFAULT now(),
user_id uuid NOT NULL,
id bigint GENERATED ALWAYS AS IDENTITY NOT NULL UNIQUE,
CONSTRAINT Source_pkey PRIMARY KEY (id, user_id),
CONSTRAINT Source_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id)
);