aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
Diffstat (limited to 'resources')
-rw-r--r--resources/dbasik.sql32
-rw-r--r--resources/setup.sql8
2 files changed, 40 insertions, 0 deletions
diff --git a/resources/dbasik.sql b/resources/dbasik.sql
new file mode 100644
index 0000000..b5bb6f9
--- /dev/null
+++ b/resources/dbasik.sql
@@ -0,0 +1,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");
diff --git a/resources/setup.sql b/resources/setup.sql
new file mode 100644
index 0000000..dac150f
--- /dev/null
+++ b/resources/setup.sql
@@ -0,0 +1,8 @@
+/* should be added manually at this point */
+CREATE DATABASE dbasik;
+\c dbasik
+
+CREATE ROLE 'dbasik' WITH LOGIN PASSWORD 'dbasik';
+GRANT ALL PRIVILEGES ON DATABASE 'dbasik' TO 'dbasik';
+ALTER DATABASE 'dbasik' OWNER TO 'dbasik';
+CREATE EXTENSION IF NOT EXISTS citext;