-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup-study-app-db.sql
111 lines (75 loc) · 3.47 KB
/
backup-study-app-db.sql
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
CREATE DATABASE db_study_app;
ALTER DATABASE db_study_app OWNER TO postgres;
\connect db_study_app
CREATE SCHEMA public;
ALTER SCHEMA public OWNER TO postgres;
COMMENT ON SCHEMA public IS 'standard public schema';
CREATE SEQUENCE public.users_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
ALTER TABLE public.users_id_seq OWNER TO postgres;
CREATE TABLE public.users (
id integer DEFAULT nextval('public.users_id_seq'::regclass) PRIMARY KEY,
name character varying,
last_name character varying,
email character varying,
password character varying,
deleted boolean,
token character varying
);
ALTER TABLE public.users OWNER TO postgres;
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
INSERT INTO public.users VALUES (1, 'Alan', 'D', '[email protected]', '123', false, null);
CREATE SEQUENCE public.topics_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.topics_id_seq OWNER TO postgres;
CREATE TABLE public.topics (
id integer DEFAULT nextval('public.topics_id_seq'::regclass) PRIMARY KEY,
create_date timestamp without time zone,
name character varying,
description character varying,
"order" integer,
priority integer,
owner_user_id integer REFERENCES public.users(id)
);
ALTER TABLE public.topics OWNER TO postgres;
ALTER SEQUENCE public.topics_id_seq OWNED BY public.topics.id;
INSERT INTO public.topics VALUES (1, '2023-05-12 00:00:00', 'Lenguaje IV', 'Aprender Java EE', 1, 1, 1);
CREATE SEQUENCE public.topic_properties_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
ALTER TABLE public.topic_properties_id_seq OWNER TO postgres;
CREATE TABLE public.topic_properties (
id integer DEFAULT nextval('public.topic_properties_id_seq'::regclass) PRIMARY KEY,
topic_id integer REFERENCES public.topics(id),
property_name character varying,
property_value character varying
);
ALTER TABLE public.topic_properties OWNER TO postgres;
ALTER SEQUENCE public.topic_properties_id_seq OWNED BY public.topic_properties.id;
INSERT INTO public.topic_properties VALUES (1, 1, 'unidad 1', '1');
CREATE SEQUENCE public.topic_items_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
ALTER TABLE public.topic_items_id_seq OWNER TO postgres;
CREATE TABLE public.topic_items (
id integer DEFAULT nextval('public.topics_id_seq'::regclass) PRIMARY KEY,
create_date timestamp without time zone,
name character varying,
description character varying,
topic_id integer REFERENCES public.topics(id)
);
ALTER TABLE public.topic_items OWNER TO postgres;
ALTER SEQUENCE public.topic_items_id_seq OWNED BY public.topic_items.id;
INSERT INTO public.topic_items VALUES (1, '2023-05-19 00:00:00', 'Tema 1', 'Algoritmos', 1);
CREATE SEQUENCE public.comments_id_seq AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE NO MAXVALUE CACHE 1;
ALTER TABLE public.comments_id_seq OWNER TO postgres;
CREATE TABLE public.comments (
id integer DEFAULT nextval('public.comments_id_seq'::regclass) PRIMARY KEY,
create_date timestamp without time zone,
content character varying,
theme_id integer REFERENCES public.topics(id),
owner_user_id integer REFERENCES public.users(id)
);
ALTER TABLE public.comments OWNER TO postgres;
ALTER SEQUENCE public.comments_id_seq OWNED BY public.comments.id;
INSERT INTO public.comments VALUES (1, '2023-05-19 00:00:00', 'Comentario 1', 1, 1);