Feature/add watchlist to user database schema (#4560)

* Add watchlist to user database schema

* Update changelog
This commit is contained in:
Thomas Kaul
2025-04-18 19:25:59 +02:00
committed by GitHub
parent f3022ca1f4
commit 1b45ce8619
4 changed files with 25 additions and 1 deletions

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Added
- Added `watchlist` to the `User` database schema as a preparation for watching assets
## 2.153.0 - 2025-04-18
### Changed

View File

@ -0,0 +1,16 @@
-- CreateTable
CREATE TABLE "_UserWatchlist" (
"A" TEXT NOT NULL,
"B" TEXT NOT NULL,
CONSTRAINT "_UserWatchlist_AB_pkey" PRIMARY KEY ("A","B")
);
-- CreateIndex
CREATE INDEX "_UserWatchlist_B_index" ON "_UserWatchlist"("B");
-- AddForeignKey
ALTER TABLE "_UserWatchlist" ADD CONSTRAINT "_UserWatchlist_A_fkey" FOREIGN KEY ("A") REFERENCES "SymbolProfile"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "_UserWatchlist" ADD CONSTRAINT "_UserWatchlist_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
provider = "postgresql"

View File

@ -191,6 +191,7 @@ model SymbolProfile {
symbolMapping Json?
url String?
userId String?
watchedBy User[] @relation("UserWatchlist")
Order Order[]
SymbolProfileOverrides SymbolProfileOverrides?
User User? @relation(fields: [userId], onDelete: Cascade, references: [id])
@ -251,6 +252,7 @@ model User {
role Role @default(USER)
thirdPartyId String?
updatedAt DateTime @updatedAt
watchlist SymbolProfile[] @relation("UserWatchlist")
Access Access[] @relation("accessGet")
AccessGive Access[] @relation("accessGive")
Account Account[]