aboutsummaryrefslogtreecommitdiffstats
path: root/migrations/dbasik.sql
blob: b5bb6f98e9981a16e4fda7d747af4297a5842243 (plain) (blame)
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
CREATE TABLE "datamap" (
  "id" int PRIMARY KEY,
  "name" varchar,
  "description" varchar
);

CREATE TABLE "datamapline" (
  "id" uuid PRIMARY KEY,
  "datamap_id" uuid,
  "name" string,
  "cellref" string,
  "sheet" string,
  "data_type" string
);

CREATE TABLE "returnitem" (
  "id" uuid PRIMARY KEY,
  "datamapline_id" uuid,
  "return_id" int,
  "value" string
);

CREATE TABLE "return" (
  "id" int PRIMARY KEY,
  "name" string
);

ALTER TABLE "datamapline" ADD FOREIGN KEY ("datamap_id") REFERENCES "datamap" ("id");

ALTER TABLE "returnitem" ADD FOREIGN KEY ("datamapline_id") REFERENCES "datamapline" ("id");

ALTER TABLE "returnitem" ADD FOREIGN KEY ("return_id") REFERENCES "return" ("id");