mirror of
https://github.com/michivonah/rss-reader.git
synced 2025-12-22 20:46:28 +01:00
plan db schema
This commit is contained in:
parent
cd549ae329
commit
a3d1e8a93a
4 changed files with 97 additions and 0 deletions
41
docs/erm/rss-reader_2025-04-30T19_35_20.850Z.dbml
Normal file
41
docs/erm/rss-reader_2025-04-30T19_35_20.850Z.dbml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
Table user {
|
||||
id uuid [ pk, not null, unique ]
|
||||
mail text [ not null, unique ]
|
||||
active boolean [ not null, default: true ]
|
||||
}
|
||||
|
||||
Table feed {
|
||||
id uuid [ pk, not null, unique ]
|
||||
name text
|
||||
url text [ not null ]
|
||||
public boolean [ not null, default: false ]
|
||||
}
|
||||
|
||||
Table articles {
|
||||
id uuid [ pk, not null, unique ]
|
||||
title text [ not null ]
|
||||
description text
|
||||
site_url text [ not null ]
|
||||
image_url text
|
||||
publish_date timestamptz [ not null ]
|
||||
feed_id uuid [ not null ]
|
||||
}
|
||||
|
||||
Table user_to_feed {
|
||||
id integer [ pk, increment, not null, unique ]
|
||||
user_id uuid [ not null ]
|
||||
feed_id uuid [ not null ]
|
||||
owner boolean [ not null, default: False ]
|
||||
}
|
||||
|
||||
Ref fk_user_to_feed_user_id_user {
|
||||
user_to_feed.user_id > user.id [ delete: no action, update: no action ]
|
||||
}
|
||||
|
||||
Ref fk_user_to_feed_feed_id_feed {
|
||||
user_to_feed.feed_id > feed.id [ delete: no action, update: no action ]
|
||||
}
|
||||
|
||||
Ref fk_articles_feed_id_feed {
|
||||
articles.feed_id > feed.id [ delete: no action, update: no action ]
|
||||
}
|
||||
45
docs/erm/rss-reader_2025-04-30T19_35_43.207Z.sql
Normal file
45
docs/erm/rss-reader_2025-04-30T19_35_43.207Z.sql
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
CREATE TABLE "user" (
|
||||
"id" UUID NOT NULL UNIQUE,
|
||||
"mail" TEXT NOT NULL UNIQUE CHECK( (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]) 1 (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])),
|
||||
"active" BOOLEAN NOT NULL DEFAULT true,
|
||||
PRIMARY KEY("id")
|
||||
);
|
||||
|
||||
CREATE TABLE "feed" (
|
||||
"id" UUID NOT NULL UNIQUE,
|
||||
"name" TEXT,
|
||||
"url" TEXT NOT NULL,
|
||||
"public" BOOLEAN NOT NULL DEFAULT false,
|
||||
PRIMARY KEY("id")
|
||||
);
|
||||
|
||||
CREATE TABLE "articles" (
|
||||
"id" UUID NOT NULL UNIQUE,
|
||||
"title" TEXT NOT NULL,
|
||||
"description" TEXT,
|
||||
"site_url" TEXT NOT NULL,
|
||||
"image_url" TEXT,
|
||||
"publish_date" TIMESTAMPTZ NOT NULL,
|
||||
"feed_id" UUID NOT NULL,
|
||||
PRIMARY KEY("id")
|
||||
);
|
||||
|
||||
CREATE TABLE "user_to_feed" (
|
||||
"id" INTEGER NOT NULL UNIQUE GENERATED BY DEFAULT AS IDENTITY,
|
||||
"user_id" UUID NOT NULL,
|
||||
"feed_id" UUID NOT NULL,
|
||||
"owner" BOOLEAN NOT NULL DEFAULT False,
|
||||
PRIMARY KEY("id")
|
||||
);
|
||||
|
||||
ALTER TABLE "user_to_feed"
|
||||
ADD FOREIGN KEY("user_id") REFERENCES "user"("id")
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
|
||||
ALTER TABLE "user_to_feed"
|
||||
ADD FOREIGN KEY("feed_id") REFERENCES "feed"("id")
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
|
||||
ALTER TABLE "articles"
|
||||
ADD FOREIGN KEY("feed_id") REFERENCES "feed"("id")
|
||||
ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
BIN
docs/erm/rss-reader_2025-04-30T19_36_05.389Z.png
Normal file
BIN
docs/erm/rss-reader_2025-04-30T19_36_05.389Z.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 114 KiB |
11
docs/erm/rss-reader_2025-04-30T19_36_16.551Z.svg
Normal file
11
docs/erm/rss-reader_2025-04-30T19_36_16.551Z.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 5.8 MiB |
Loading…
Add table
Add a link
Reference in a new issue