Added defaults for Playlist object.

This commit is contained in:
Jonathan Bernard 2016-02-15 16:30:43 -06:00
parent 151ce9e462
commit a17589d540
2 changed files with 8 additions and 6 deletions

View File

@ -4,12 +4,14 @@ import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
public class Playlist extends Model { public class Playlist extends Model {
public boolean userCreated; public boolean userCreated = false;
public Timestamp lastUsed = new Timestamp(new Date().getTime()); public Timestamp lastUsed = new Timestamp(new Date().getTime());
public String name; public String name;
public int modCount; public int modCount = 0;
public int mediaFileCount; public int mediaFileCount = 0;
public Integer copiedFromId; public Integer copiedFromId = null;
public String toString() { return name; } public String toString() {
if (userCreated) return name;
return name + " (auto)"; }
} }

View File

@ -52,7 +52,7 @@ CREATE TABLE playlists (
name VARCHAR NOT NULL, name VARCHAR NOT NULL,
mod_count INTEGER NOT NULL DEFAULT 0, mod_count INTEGER NOT NULL DEFAULT 0,
media_file_count INTEGER NOT NULL DEFAULT 0, media_file_count INTEGER NOT NULL DEFAULT 0,
copied_from_id INTEGER REFERENCES playlists(id) copied_from_id INTEGER REFERENCES playlists(id) DEFAULT NULL
); );
CREATE TABLE playlists_media_files ( CREATE TABLE playlists_media_files (