Changes to the data model.
* Added bookmarks.{last_used,play_time_ms}. * Removed playlists.mod_count * Added tags.description.
This commit is contained in:
parent
7101535412
commit
33e470c871
@ -8,8 +8,10 @@ public class Bookmark extends Model {
|
||||
public int playlistId;
|
||||
public int mediaFileId;
|
||||
public int playIndex;
|
||||
public boolean user_created;
|
||||
public int playTimeMs = 0;
|
||||
public boolean userCreated;
|
||||
public Timestamp createdAt = new Timestamp(new Date().getTime());
|
||||
public Timestamp lastUsed = new Timestamp(new Date().getTime());
|
||||
|
||||
public String toString() { return name; }
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
public class Model {
|
||||
public int id;
|
||||
public Integer id;
|
||||
|
||||
public boolean equals(Object thatObj) {
|
||||
if (thatObj == null) return false;
|
||||
|
@ -5,12 +5,11 @@ import java.util.Date;
|
||||
|
||||
public class Playlist extends Model {
|
||||
public boolean userCreated = false;
|
||||
public Timestamp lastUsed = new Timestamp(new Date().getTime());
|
||||
public String name;
|
||||
public int modCount = 0;
|
||||
public int mediaFileCount = 0;
|
||||
public Integer copiedFromId = null;
|
||||
public Timestamp createdAt = new Timestamp(new Date().getTime());
|
||||
public Timestamp lastUsed = new Timestamp(new Date().getTime());
|
||||
|
||||
public String toString() {
|
||||
if (userCreated) return name;
|
||||
|
@ -2,6 +2,10 @@ package com.jdbernard.wdiwtlt.db.models;
|
||||
|
||||
public class Tag extends Model {
|
||||
public String name;
|
||||
public String description = "";
|
||||
|
||||
public String toString() { return name; }
|
||||
public String toString() {
|
||||
if (description != null && description.length() > 0)
|
||||
return name + " (" + description + ")";
|
||||
else return name; }
|
||||
}
|
||||
|
@ -44,25 +44,26 @@ CREATE TABLE albums_media_files (
|
||||
|
||||
CREATE TABLE tags (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR UNIQUE NOT NULL
|
||||
name VARCHAR UNIQUE NOT NULL,
|
||||
description VARCHAR NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE TABLE playlists (
|
||||
id SERIAL PRIMARY KEY,
|
||||
user_created BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
last_used TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
name VARCHAR NOT NULL,
|
||||
mod_count INTEGER NOT NULL DEFAULT 0,
|
||||
media_file_count INTEGER NOT NULL DEFAULT 0,
|
||||
copied_from_id INTEGER REFERENCES playlists(id) DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
last_used TIMESTAMP NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE TABLE playlists_media_files (
|
||||
playlist_id INTEGER NOT NULL REFERENCES playlists(id) ON DELETE CASCADE,
|
||||
media_file_id INTEGER NOT NULL REFERENCES media_files(id) ON DELETE CASCADE,
|
||||
position INTEGER NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (playlist_id, media_file_id, position)
|
||||
PRIMARY KEY (playlist_id, media_file_id, position),
|
||||
UNIQUE (playlist_id, position)
|
||||
);
|
||||
|
||||
CREATE TABLE bookmarks (
|
||||
@ -72,7 +73,9 @@ CREATE TABLE bookmarks (
|
||||
playlist_id INTEGER NOT NULL REFERENCES playlists(id) ON DELETE CASCADE,
|
||||
media_file_id INTEGER NOT NULL REFERENCES media_files(id) ON DELETE CASCADE,
|
||||
play_index INTEGER NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
||||
play_time_ms INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
last_used TIMESTAMP NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX bookmarks_playlist_id_idx ON bookmarks (playlist_id);
|
||||
|
Loading…
Reference in New Issue
Block a user