Make playlist title unique
This commit is contained in:
@ -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)
|
||||||
|
|||||||
@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user