Add necessary columns to User.
This commit is contained in:
parent
5eee07da90
commit
23235a7fe8
2 changed files with 36 additions and 0 deletions
|
@ -112,6 +112,9 @@ class User(CreatedBase):
|
|||
volunteer_last_started_utc = Column(DateTime, nullable=True)
|
||||
volunteer_janitor_correctness = Column(Float, default=0, nullable=False)
|
||||
|
||||
chat_authorized = Column(Boolean, default=False, nullable=False)
|
||||
chat_lastseen = Column(DateTime(timezone=True), default=datetime(1970, 1, 1), nullable=False)
|
||||
|
||||
Index(
|
||||
'users_original_username_trgm_idx',
|
||||
original_username,
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
"""add necessary chat fields to the user
|
||||
|
||||
Revision ID: 503fd4d18a54
|
||||
Revises: 5876cd139e31
|
||||
Create Date: 2023-08-27 07:19:35.276103+00:00
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '503fd4d18a54'
|
||||
down_revision = '5876cd139e31'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('users', sa.Column('chat_authorized', sa.Boolean()))
|
||||
op.execute("UPDATE users SET chat_authorized = FALSE")
|
||||
op.alter_column('users', 'chat_authorized', nullable=False)
|
||||
|
||||
op.add_column('users', sa.Column('chat_lastseen', sa.DateTime(timezone=True)))
|
||||
op.execute("UPDATE users SET chat_lastseen = '1970-01-01 00:00:00'")
|
||||
op.alter_column('users', 'chat_lastseen', nullable=False)
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'chat_lastseen')
|
||||
op.drop_column('users', 'chat_authorized')
|
||||
# ### end Alembic commands ###
|
Loading…
Add table
Add a link
Reference in a new issue