Add track_number and track_total. Added indexes on item names.
This commit is contained in:
parent
d72ce4467f
commit
b605b56221
service/src/main
java/com/jdbernard/wdiwtlt/db/models
sql/migrations
@ -4,7 +4,10 @@ package com.jdbernard.wdiwtlt.db.models;
|
|||||||
public class Album {
|
public class Album {
|
||||||
public int id;
|
public int id;
|
||||||
public String name;
|
public String name;
|
||||||
|
public Integer trackTotal;
|
||||||
public Integer year;
|
public Integer year;
|
||||||
|
|
||||||
public String toString() { return name + " (" + year + ")"; }
|
public String toString() {
|
||||||
|
if (year != null) return name + " (" + year + ")";
|
||||||
|
else return name; }
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ public class MediaFile {
|
|||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
public String name;
|
public String name;
|
||||||
|
public Integer trackNumber;
|
||||||
public int playCount = 0;
|
public int playCount = 0;
|
||||||
public String filePath;
|
public String filePath;
|
||||||
public String fileHash;
|
public String fileHash;
|
||||||
|
@ -3,15 +3,21 @@ CREATE TABLE artists (
|
|||||||
name VARCHAR UNIQUE NOT NULL
|
name VARCHAR UNIQUE NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX artists_name_idx ON artists(name);
|
||||||
|
|
||||||
CREATE TABLE albums (
|
CREATE TABLE albums (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
name VARCHAR NOT NULL,
|
name VARCHAR NOT NULL,
|
||||||
year INTEGER
|
year INTEGER,
|
||||||
|
track_total INTEGER
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX albums_name_idx ON albums(name);
|
||||||
|
|
||||||
CREATE TABLE media_files (
|
CREATE TABLE media_files (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
name VARCHAR NOT NULL,
|
name VARCHAR NOT NULL,
|
||||||
|
track_number INTEGER,
|
||||||
play_count INTEGER NOT NULL DEFAULT 0,
|
play_count INTEGER NOT NULL DEFAULT 0,
|
||||||
file_path VARCHAR NOT NULL,
|
file_path VARCHAR NOT NULL,
|
||||||
file_hash VARCHAR NOT NULL,
|
file_hash VARCHAR NOT NULL,
|
||||||
@ -19,6 +25,8 @@ CREATE TABLE media_files (
|
|||||||
comment VARCHAR DEFAULT ''
|
comment VARCHAR DEFAULT ''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX media_files_name_idx ON media_files(name);
|
||||||
|
|
||||||
CREATE TABLE artists_media_files (
|
CREATE TABLE artists_media_files (
|
||||||
artist_id INTEGER NOT NULL REFERENCES artists(id) ON DELETE CASCADE,
|
artist_id INTEGER NOT NULL REFERENCES artists(id) ON DELETE CASCADE,
|
||||||
media_file_id INTEGER NOT NULL REFERENCES media_files(id) ON DELETE CASCADE,
|
media_file_id INTEGER NOT NULL REFERENCES media_files(id) ON DELETE CASCADE,
|
||||||
|
Loading…
Reference in New Issue
Block a user