-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.sql
42 lines (35 loc) · 1.42 KB
/
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
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 "Tours" (
"Id" uuid NOT NULL,
"Name" character varying(200) NOT NULL,
"Description" character varying(500) NOT NULL,
"From" character varying(100) NOT NULL,
"To" character varying(100) NOT NULL,
"ImagePath" character varying(10000),
"RouteInformation" character varying(30000),
"Distance" numeric(18,2),
"EstimatedTime" double precision,
"TransportType" character varying(50) NOT NULL,
CONSTRAINT "PK_Tours" PRIMARY KEY ("Id")
);
CREATE TABLE "TourLogs" (
"Id" uuid NOT NULL,
"DateTime" timestamp with time zone NOT NULL,
"Comment" character varying(500) NOT NULL,
"Difficulty" double precision,
"TotalDistance" numeric(18,2),
"TotalTime" double precision,
"Rating" double precision,
"TourPersistenceId" uuid NOT NULL,
CONSTRAINT "PK_TourLogs" PRIMARY KEY ("Id"),
CONSTRAINT "FK_TourLogs_Tours_TourPersistenceId" FOREIGN KEY ("TourPersistenceId") REFERENCES "Tours" ("Id") ON DELETE CASCADE
);
CREATE INDEX "IX_TourLogs_TourPersistenceId" ON "TourLogs" ("TourPersistenceId");
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
VALUES ('20240628212405_Initial', '8.0.5');
COMMIT;