File size: 2,155 Bytes
25f22bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- 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)
);