From 8edf5427261e1ca69622527ed3b3fae03d60d008 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Tue, 8 Mar 2016 09:45:51 -0600 Subject: [PATCH] Added create_at fields on playlists and bookmarks. --- .../main/java/com/jdbernard/wdiwtlt/db/models/Bookmark.java | 3 +++ .../main/java/com/jdbernard/wdiwtlt/db/models/Playlist.java | 1 + .../sql/migrations/20151209054632-initial-schema-up.sql | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Bookmark.java b/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Bookmark.java index 3860ba4..0565904 100644 --- a/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Bookmark.java +++ b/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Bookmark.java @@ -1,11 +1,14 @@ package com.jdbernard.wdiwtlt.db.models; +import java.util.Date; + public class Bookmark extends Model { public String name; public int playlistId; public int mediaFileId; public int playIndex; public boolean user_created; + public Date createdAt = new Date(); public String toString() { return name; } } diff --git a/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Playlist.java b/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Playlist.java index 326e2b3..41fbcb2 100644 --- a/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Playlist.java +++ b/core/src/main/java/com/jdbernard/wdiwtlt/db/models/Playlist.java @@ -10,6 +10,7 @@ public class Playlist extends Model { public int modCount = 0; public int mediaFileCount = 0; public Integer copiedFromId = null; + public Date createdAt = new Date()t; public String toString() { if (userCreated) return name; diff --git a/core/src/main/sql/migrations/20151209054632-initial-schema-up.sql b/core/src/main/sql/migrations/20151209054632-initial-schema-up.sql index 59a7c70..97142e8 100644 --- a/core/src/main/sql/migrations/20151209054632-initial-schema-up.sql +++ b/core/src/main/sql/migrations/20151209054632-initial-schema-up.sql @@ -53,7 +53,8 @@ CREATE TABLE playlists ( 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 + copied_from_id INTEGER REFERENCES playlists(id) DEFAULT NULL, + created_at TIMESTAMP NOT NULL DEFAULT NOW() ); CREATE TABLE playlists_media_files ( @@ -69,7 +70,8 @@ CREATE TABLE bookmarks ( user_created BOOLEAN NOT NULL DEFAULT FALSE, 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 + play_index INTEGER NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT NOW() ); CREATE TABLE media_files_tags (