Add track_number and track_total. Added indexes on item names.
This commit is contained in:
parent
d72ce4467f
commit
b605b56221
@ -4,7 +4,10 @@ package com.jdbernard.wdiwtlt.db.models;
|
||||
public class Album {
|
||||
public int id;
|
||||
public String name;
|
||||
public Integer trackTotal;
|
||||
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 String name;
|
||||
public Integer trackNumber;
|
||||
public int playCount = 0;
|
||||
public String filePath;
|
||||
public String fileHash;
|
||||
|
@ -3,15 +3,21 @@ CREATE TABLE artists (
|
||||
name VARCHAR UNIQUE NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX artists_name_idx ON artists(name);
|
||||
|
||||
CREATE TABLE albums (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR NOT NULL,
|
||||
year INTEGER
|
||||
year INTEGER,
|
||||
track_total INTEGER
|
||||
);
|
||||
|
||||
CREATE INDEX albums_name_idx ON albums(name);
|
||||
|
||||
CREATE TABLE media_files (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR NOT NULL,
|
||||
track_number INTEGER,
|
||||
play_count INTEGER NOT NULL DEFAULT 0,
|
||||
file_path VARCHAR NOT NULL,
|
||||
file_hash VARCHAR NOT NULL,
|
||||
@ -19,6 +25,8 @@ CREATE TABLE media_files (
|
||||
comment VARCHAR DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE INDEX media_files_name_idx ON media_files(name);
|
||||
|
||||
CREATE TABLE artists_media_files (
|
||||
artist_id INTEGER NOT NULL REFERENCES artists(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