Skip to content

Commit

Permalink
feat: add created_at, modified_at in ticket_holder (#6660)
Browse files Browse the repository at this point in the history
  • Loading branch information
codedsun authored and iamareebjamal committed Dec 13, 2019
1 parent 9a2375a commit 5a4ef10
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/ticket_holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class TicketHolder(SoftDeletionModel):
checkout_times: str = db.Column(db.String)
attendee_notes: str = db.Column(db.String)
event_id: int = db.Column(db.Integer, db.ForeignKey('events.id', ondelete='CASCADE'))
created_at: datetime = db.Column(db.DateTime(timezone=True), default=datetime.utcnow)
modified_at: datetime = db.Column(db.DateTime(timezone=True), default=datetime.utcnow, onupdate=datetime.utcnow)
complex_field_values: str = db.Column(db.JSON)
user = db.relationship('User', foreign_keys=[email], primaryjoin='User.email == TicketHolder.email', viewonly=True,
backref='attendees')
Expand Down
30 changes: 30 additions & 0 deletions migrations/versions/rev-2019-12-13-20:34:35-8621f70992ba_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""empty message
Revision ID: 8621f70992ba
Revises: 0223c881d135
Create Date: 2019-12-13 20:34:35.014066
"""

from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils


# revision identifiers, used by Alembic.
revision = '8621f70992ba'
down_revision = '0223c881d135'


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('ticket_holders', sa.Column('created_at', sa.DateTime(timezone=True), nullable=True))
op.add_column('ticket_holders', sa.Column('modified_at', sa.DateTime(timezone=True), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('ticket_holders', 'modified_at')
op.drop_column('ticket_holders', 'created_at')
# ### end Alembic commands ###

0 comments on commit 5a4ef10

Please sign in to comment.