Make playlist title unique

This commit is contained in:
2025-11-09 21:39:58 +05:00
parent a59c1a7a01
commit 6ccb1af8e5
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ public class Playlist {
@JoinColumn(name = "owner_id", nullable = false) @JoinColumn(name = "owner_id", nullable = false)
private User owner; private User owner;
@Column(nullable = false, length = 500) @Column(unique = true, nullable = false, length = 500)
private String title; private String title;
@Column(name = "created_at", nullable = false, updatable = false) @Column(name = "created_at", nullable = false, updatable = false)

View File

@ -51,7 +51,7 @@ CREATE TABLE IF NOT EXISTS "track_metadata" (
CREATE TABLE IF NOT EXISTS "playlist" ( CREATE TABLE IF NOT EXISTS "playlist" (
"id" bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY, "id" bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
"owner_id" bigint NOT NULL, "owner_id" bigint NOT NULL,
"title" varchar(500) NOT NULL, "title" varchar(500) NOT NULL UNIQUE,
"created_at" timestamp NOT NULL DEFAULT NOW(), "created_at" timestamp NOT NULL DEFAULT NOW(),
"updated_at" timestamp NOT NULL DEFAULT NOW(), "updated_at" timestamp NOT NULL DEFAULT NOW(),
CONSTRAINT "fk_playlist_owner_id" CONSTRAINT "fk_playlist_owner_id"