-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmigration.sql
More file actions
100 lines (88 loc) · 5.72 KB
/
migration.sql
File metadata and controls
100 lines (88 loc) · 5.72 KB
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
CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" (
"MigrationId" character varying(150) NOT NULL,
"ProductVersion" character varying(32) NOT NULL,
CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId")
);
START TRANSACTION;
CREATE TABLE "Users" (
"Id" integer GENERATED BY DEFAULT AS IDENTITY,
"CPF" text,
"Name" character varying(100) NOT NULL,
"Email" character varying(100) NOT NULL,
"Type" text NOT NULL,
"ImagePath" text,
"Password" text NOT NULL,
CONSTRAINT "PK_Users" PRIMARY KEY ("Id")
);
CREATE TABLE "Exercises" (
"Id" integer GENERATED BY DEFAULT AS IDENTITY,
"Name" character varying(100) NOT NULL,
"Description" text,
"ImagePath" text,
"VideoPath" text,
"Day" integer,
"UserId" integer NOT NULL,
CONSTRAINT "PK_Exercises" PRIMARY KEY ("Id"),
CONSTRAINT "FK_Exercises_Users_UserId" FOREIGN KEY ("UserId") REFERENCES "Users" ("Id") ON DELETE CASCADE
);
CREATE TABLE "Sessions" (
"Id" integer GENERATED BY DEFAULT AS IDENTITY,
"Repetitions" integer NOT NULL,
"Series" integer NOT NULL,
"Breaks" double precision NOT NULL,
"Time" double precision NOT NULL,
"ExerciseId" integer NOT NULL,
CONSTRAINT "PK_Sessions" PRIMARY KEY ("Id"),
CONSTRAINT "FK_Sessions_Exercises_ExerciseId" FOREIGN KEY ("ExerciseId") REFERENCES "Exercises" ("Id") ON DELETE CASCADE
);
INSERT INTO "Users" ("Id", "CPF", "Email", "ImagePath", "Name", "Password", "Type")
VALUES (1, '123.456.789-01', 'adm@gmail.com', 'defaultphoto.jpg', 'Admin', 'AQAAAAIAAYagAAAAEObbl94OOgivuB9hl2yNRdyqmZDc1zhksnBTQsMNAUl05d+ekcUHUZP5VeHfL53Lpg==', 'Administrador');
INSERT INTO "Users" ("Id", "CPF", "Email", "ImagePath", "Name", "Password", "Type")
VALUES (2, '987.654.321-09', 'jose@gmail.com', 'defaultphoto.jpg', 'José', 'AQAAAAIAAYagAAAAEI0E/z+kTrGJvlbiYunG/A6usyz0SQtMYkqht7Sg5GItMa3MjkkwfbUhLlvV3cmPlw==', 'Professor');
INSERT INTO "Users" ("Id", "CPF", "Email", "ImagePath", "Name", "Password", "Type")
VALUES (3, '123.456.789-01', 'maria@gmail.com', 'defaultphoto.jpg', 'Maria', 'AQAAAAIAAYagAAAAEKwD4UAJZq3JXJL600d8hlyhyXIS72tzWhOA0ClRNtRTPxIRK9UWzKRg4qM4+FJUGw==', 'Aluno');
INSERT INTO "Users" ("Id", "CPF", "Email", "ImagePath", "Name", "Password", "Type")
VALUES (4, '123.456.789-01', 'joao@gmail.com', 'defaultphoto.jpg', 'João', 'AQAAAAIAAYagAAAAEOJK3uYuItjVg7Glpre4mvw0SDnhU+ohbTAg03BqG6UDIYWn4fnVahH7lpjpjjUg2w==', 'Aluno');
INSERT INTO "Exercises" ("Id", "Day", "Description", "ImagePath", "Name", "UserId", "VideoPath")
VALUES (1, 5, 'Use uma pegada pronada, com as palmas das mãos voltadas para o corpo, para segurar a barra. Mantenha os joelhos flexionados na posição de agachamento, a coluna ereta e alinhada, e as pernas abertas com os pés apontados para fora.', 'images/exe2.png', 'Agachamento Terra', 3, 'videos/execucao.mp4');
INSERT INTO "Exercises" ("Id", "Day", "Description", "ImagePath", "Name", "UserId", "VideoPath")
VALUES (2, 5, 'Sente-se em um banco e incline-se levemente, mantendo o peito erguido. Flexione o braço para levantar o halter até o ombro, pause por um segundo no topo e estenda lentamente o braço para retornar à posição inicial.', 'images/exe.png', 'Rosca Concentrada', 4, 'videos/execucao.mp4');
INSERT INTO "Exercises" ("Id", "Day", "Description", "ImagePath", "Name", "UserId", "VideoPath")
VALUES (3, 1, 'Deite-se em um banco plano, segure a barra com uma pegada média e abaixe-a até tocar levemente o peito. Empurre a barra para cima até que os braços estejam completamente estendidos.', 'images/exe3.png', 'Supino Reto', 3, 'videos/execucao.mp4');
INSERT INTO "Exercises" ("Id", "Day", "Description", "ImagePath", "Name", "UserId", "VideoPath")
VALUES (4, 3, 'Sente-se no aparelho de puxada e segure a barra com uma pegada ampla. Puxe a barra em direção ao peito enquanto mantém a coluna reta, contraindo os músculos das costas. Retorne à posição inicial de forma controlada.', 'images/exe4.png', 'Puxada Aberta', 3, 'videos/execucao.mp4');
INSERT INTO "Exercises" ("Id", "Day", "Description", "ImagePath", "Name", "UserId", "VideoPath")
VALUES (5, 5, 'Fique em pé com os pés na largura dos ombros, segure a barra com uma pegada mista e mantenha a coluna reta. Levante a barra do chão até a altura do quadril, mantendo o controle, e abaixe-a lentamente.', 'images/exe5.png', 'Levantamento Terra', 4, 'videos/execucao.mp4');
INSERT INTO "Sessions" ("Id", "Breaks", "ExerciseId", "Repetitions", "Series", "Time")
VALUES (1, 60.0, 1, 10, 3, 5.0);
INSERT INTO "Sessions" ("Id", "Breaks", "ExerciseId", "Repetitions", "Series", "Time")
VALUES (2, 45.0, 2, 12, 4, 6.0);
INSERT INTO "Sessions" ("Id", "Breaks", "ExerciseId", "Repetitions", "Series", "Time")
VALUES (3, 90.0, 3, 8, 5, 7.5);
INSERT INTO "Sessions" ("Id", "Breaks", "ExerciseId", "Repetitions", "Series", "Time")
VALUES (4, 30.0, 4, 15, 3, 4.5);
INSERT INTO "Sessions" ("Id", "Breaks", "ExerciseId", "Repetitions", "Series", "Time")
VALUES (5, 120.0, 5, 6, 6, 10.0);
CREATE INDEX "IX_Exercises_UserId" ON "Exercises" ("UserId");
CREATE INDEX "IX_Sessions_ExerciseId" ON "Sessions" ("ExerciseId");
SELECT setval(
pg_get_serial_sequence('"Users"', 'Id'),
GREATEST(
(SELECT MAX("Id") FROM "Users") + 1,
nextval(pg_get_serial_sequence('"Users"', 'Id'))),
false);
SELECT setval(
pg_get_serial_sequence('"Exercises"', 'Id'),
GREATEST(
(SELECT MAX("Id") FROM "Exercises") + 1,
nextval(pg_get_serial_sequence('"Exercises"', 'Id'))),
false);
SELECT setval(
pg_get_serial_sequence('"Sessions"', 'Id'),
GREATEST(
(SELECT MAX("Id") FROM "Sessions") + 1,
nextval(pg_get_serial_sequence('"Sessions"', 'Id'))),
false);
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
VALUES ('20250225162024_initialDb', '9.0.0');
COMMIT;