summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWriterV2 <primary-v2@protonmail.com>2024-11-06 17:38:25 +0100
committerWriterV2 <primary-v2@protonmail.com>2024-11-06 17:38:25 +0100
commit3fc548058bac5ef33f3955f4188bf6bea9ac9311 (patch)
treedd571ad1562d733c9c5dc9b55ef8eba454c0173a
parent845073129204835413b53bb40ca7b6a7806d373a (diff)
Feat: Update db to set tag for product instead of specific product
-rw-r--r--.dockerignore1
-rw-r--r--documentation/er-model.pdfbin0 -> 142284 bytes
-rw-r--r--migrations/20241106161637_tagredesign.sql13
-rw-r--r--src/db/gametag.rs5
-rw-r--r--src/db/mod.rs4
-rw-r--r--src/db/producttag.rs (renamed from src/db/storytag.rs)4
-rw-r--r--src/db/tooltag.rs5
7 files changed, 17 insertions, 15 deletions
diff --git a/.dockerignore b/.dockerignore
index c3e7034..fc04251 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -2,3 +2,4 @@ target/
.git/
.env
*.db
+documentation/
diff --git a/documentation/er-model.pdf b/documentation/er-model.pdf
new file mode 100644
index 0000000..2a6d49c
--- /dev/null
+++ b/documentation/er-model.pdf
Binary files differ
diff --git a/migrations/20241106161637_tagredesign.sql b/migrations/20241106161637_tagredesign.sql
new file mode 100644
index 0000000..c33cec3
--- /dev/null
+++ b/migrations/20241106161637_tagredesign.sql
@@ -0,0 +1,13 @@
+DROP TABLE IF EXISTS storytag;
+DROP TABLE IF EXISTS gametag;
+DROP TABLE IF EXISTS tooltag;
+
+CREATE TABLE IF NOT EXISTS producttag
+(
+ pid INTEGER NOT NULL,
+ tid INTEGER NOT NULL,
+ FOREIGN KEY (pid) REFERENCES product(id),
+ FOREIGN KEY (tid) REFERENCES tag(id),
+ PRIMARY KEY (pid, tid)
+);
+
diff --git a/src/db/gametag.rs b/src/db/gametag.rs
deleted file mode 100644
index 335d2a4..0000000
--- a/src/db/gametag.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#[derive(Debug, serde::Serialize, sqlx::FromRow)]
-pub struct Gametag {
- pub gid: i64,
- pub tgid: i64,
-}
diff --git a/src/db/mod.rs b/src/db/mod.rs
index 0b310c6..7050527 100644
--- a/src/db/mod.rs
+++ b/src/db/mod.rs
@@ -4,13 +4,11 @@ use crate::error::AppError;
use async_trait::async_trait;
pub mod game;
-pub mod gametag;
pub mod product;
+pub mod producttag;
pub mod story;
-pub mod storytag;
pub mod tag;
pub mod tool;
-pub mod tooltag;
#[async_trait]
pub trait ProductDatabaseHandler {
diff --git a/src/db/storytag.rs b/src/db/producttag.rs
index 0953fc2..b3091c3 100644
--- a/src/db/storytag.rs
+++ b/src/db/producttag.rs
@@ -1,5 +1,5 @@
#[derive(Debug, serde::Serialize, sqlx::FromRow)]
pub struct Storytag {
- pub sid: i64,
- pub tgid: i64,
+ pub pid: i64,
+ pub tid: i64,
}
diff --git a/src/db/tooltag.rs b/src/db/tooltag.rs
deleted file mode 100644
index 393e687..0000000
--- a/src/db/tooltag.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#[derive(Debug, serde::Serialize, sqlx::FromRow)]
-pub struct Tooltag {
- pub tid: i64,
- pub tgid: i64,
-}