Browse Source

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

* Add watchlist to user database schema

* Update changelog
pull/4562/head^2
Thomas Kaul 2 weeks ago
committed by GitHub
parent
commit
1b45ce8619
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      CHANGELOG.md
  2. 16
      prisma/migrations/20250418123137_added_watchlist_to_user/migration.sql
  3. 2
      prisma/schema.prisma

6
CHANGELOG.md

@ -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/), 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). 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 ## 2.153.0 - 2025-04-18
### Changed ### Changed

16
prisma/migrations/20250418123137_added_watchlist_to_user/migration.sql

@ -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;

2
prisma/schema.prisma

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

Loading…
Cancel
Save