File size: 2,482 Bytes
25f22bf
 
 
 
651d45b
25f22bf
 
651d45b
25f22bf
 
 
 
651d45b
25f22bf
651d45b
 
25f22bf
 
 
 
 
651d45b
25f22bf
 
 
 
 
651d45b
25f22bf
 
651d45b
 
25f22bf
 
 
 
 
651d45b
25f22bf
 
 
 
651d45b
25f22bf
 
 
 
 
 
 
651d45b
 
 
 
 
 
 
 
 
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
51
52
53
54
55
56
57
58
59
60
-- 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 bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
  id_social bigint,
  Text_content text,
  image_content_url bytea,
  Video_content text,
  post_time time without time zone,
  created_at timestamp with time zone NOT NULL DEFAULT now(),
  is_published boolean DEFAULT false,
  sched bigint,
  CONSTRAINT Post_content_pkey PRIMARY KEY (id),
  CONSTRAINT Post_content_sched_fkey FOREIGN KEY (sched) REFERENCES public.Scheduling(id),
  CONSTRAINT Post_content_id_social_fkey FOREIGN KEY (id_social) REFERENCES public.Social_network(id)
);
CREATE TABLE public.Scheduling (
  id bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
  id_social bigint,
  schedule_time character varying,
  created_at timestamp with time zone NOT NULL DEFAULT now(),
  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 bigint GENERATED ALWAYS AS IDENTITY NOT NULL,
  social_network character varying NOT NULL,
  token character varying NOT NULL UNIQUE,
  id_utilisateur uuid DEFAULT gen_random_uuid(),
  created_at timestamp with time zone NOT NULL DEFAULT now(),
  sub character varying NOT NULL UNIQUE,
  given_name character varying NOT NULL,
  picture character varying NOT NULL,
  family_name character varying NOT NULL,
  account_name text NOT NULL UNIQUE,
  expiration date,
  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 (
  id bigint GENERATED ALWAYS AS IDENTITY NOT NULL UNIQUE,
  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,
  CONSTRAINT Source_pkey PRIMARY KEY (id, user_id),
  CONSTRAINT Source_user_id_fkey FOREIGN KEY (user_id) REFERENCES auth.users(id)
);
CREATE TABLE public.profiles (
  id uuid NOT NULL,
  email text UNIQUE,
  raw_user_meta jsonb,
  created_at timestamp with time zone DEFAULT now(),
  updated_at timestamp with time zone,
  CONSTRAINT profiles_pkey PRIMARY KEY (id),
  CONSTRAINT profiles_id_fkey FOREIGN KEY (id) REFERENCES auth.users(id)
);