add User.trial_end column

This commit is contained in:
Son NK 2020-01-30 10:10:28 +07:00
parent 9f95edf203
commit 354e5f9a67
2 changed files with 34 additions and 0 deletions

View file

@ -122,6 +122,11 @@ class User(db.Model, ModelMixin, UserMixin):
# some users could have lifetime premium # some users could have lifetime premium
lifetime = db.Column(db.Boolean, default=False, nullable=False, server_default="0") lifetime = db.Column(db.Boolean, default=False, nullable=False, server_default="0")
# user can use all premium features until this date
trial_end = db.Column(
ArrowType, default=lambda: arrow.now().shift(days=7), nullable=True
)
profile_picture = db.relationship(File) profile_picture = db.relationship(File)
@classmethod @classmethod

View file

@ -0,0 +1,29 @@
"""empty message
Revision ID: 7c39ba4ec38d
Revises: ba6f13ccbabb
Create Date: 2020-01-30 10:10:01.245257
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7c39ba4ec38d'
down_revision = 'ba6f13ccbabb'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('trial_end', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'trial_end')
# ### end Alembic commands ###