Added copied_from_id on playlists. Fixed timestamp values in models.

This commit is contained in:
Jonathan Bernard 2016-02-13 23:27:30 -06:00
parent 20e4733f5a
commit 8090b5b914
3 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package com.jdbernard.wdiwtlt.db.models; package com.jdbernard.wdiwtlt.db.models;
import java.util.Date; import java.util.Date;
import java.sql.Timestamp;
public class MediaFile extends Model { public class MediaFile extends Model {
public static final String TAG_INFO = "tag info"; public static final String TAG_INFO = "tag info";
@ -12,7 +13,7 @@ public class MediaFile extends Model {
public String filePath; public String filePath;
public String fileHash; public String fileHash;
public String metaInfoSource = TAG_INFO; public String metaInfoSource = TAG_INFO;
public Date dateAdded; public Date dateAdded = new Timestamp(new Date().getTime());
public String comment; public String comment;
public String toString() { return name; } public String toString() { return name; }

View File

@ -1,13 +1,15 @@
package com.jdbernard.wdiwtlt.db.models; package com.jdbernard.wdiwtlt.db.models;
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;
public Date lastUsed; public Timestamp lastUsed = new Timestamp(new Date().getTime());
public String name; public String name;
public int modCount; public int modCount;
public int mediaFileCount; public int mediaFileCount;
public Integer copiedFromId;
public String toString() { return name; } public String toString() { return name; }
} }

View File

@ -51,7 +51,8 @@ CREATE TABLE playlists (
last_used TIMESTAMP NOT NULL DEFAULT NOW(), last_used TIMESTAMP NOT NULL DEFAULT NOW(),
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)
); );
CREATE TABLE playlists_media_files ( CREATE TABLE playlists_media_files (