Set track_like date column default value

This commit is contained in:
Ben 2019-09-09 22:27:13 +01:00
parent 1c03374bd8
commit 4e8a73591b
2 changed files with 4 additions and 2 deletions

View File

@ -971,6 +971,8 @@ CREATE TABLE track_like (
CREATE INDEX track_like_track_id ON track_like (track_id); CREATE INDEX track_like_track_id ON track_like (track_id);
ALTER TABLE track_like ALTER COLUMN date SET DEFAULT now();
COMMENT ON TABLE track_like IS 'SoundStudio likes'; COMMENT ON TABLE track_like IS 'SoundStudio likes';
COMMENT ON COLUMN track_like.track_id IS 'Liked track ID'; COMMENT ON COLUMN track_like.track_id IS 'Liked track ID';

View File

@ -1,4 +1,4 @@
from houdini.data import db from houdini.data import db, BaseCrumbsCollection
class PenguinTrack(db.Model): class PenguinTrack(db.Model):
@ -19,4 +19,4 @@ class TrackLike(db.Model):
nullable=False) nullable=False)
track_id = db.Column(db.ForeignKey('penguin_track.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, track_id = db.Column(db.ForeignKey('penguin_track.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
nullable=False, index=True) nullable=False, index=True)
date = db.Column(db.DateTime, primary_key=True, nullable=False) date = db.Column(db.DateTime, primary_key=True, nullable=False, server_default=db.text("now()"))