diff options
author | Matthew Lemon <y@yulqen.org> | 2024-03-13 16:23:18 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-03-13 16:23:18 +0000 |
commit | 5607c7558178c8cc84ee1ec3d7f4b39dbfc10f4f (patch) | |
tree | 31d7529ccbaa79c3ee3a2720aa669a8628624f8f | |
parent | e425d75c00cac5b0b5d4330951af8a15f6f8c6e9 (diff) |
Adds errors file and dbasik.sql
-rw-r--r-- | cmd/api/errors.go | 7 | ||||
-rw-r--r-- | migrations/dbasik.sql | 32 |
2 files changed, 39 insertions, 0 deletions
diff --git a/cmd/api/errors.go b/cmd/api/errors.go new file mode 100644 index 0000000..77833f3 --- /dev/null +++ b/cmd/api/errors.go @@ -0,0 +1,7 @@ +package main + +import "net/http" + +func (app *application) logError(r http.Request, err error) { + app.logger.Info(err) +} diff --git a/migrations/dbasik.sql b/migrations/dbasik.sql new file mode 100644 index 0000000..b5bb6f9 --- /dev/null +++ b/migrations/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"); |