e33bf2621069_alert_table.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. """alert table
  2. Revision ID: e33bf2621069
  3. Revises:
  4. Create Date: 2021-12-13 16:02:15.900470
  5. """
  6. from datetime import datetime
  7. from alembic import op
  8. import sqlalchemy as sa
  9. # revision identifiers, used by Alembic.
  10. revision = 'e33bf2621069'
  11. down_revision = None
  12. branch_labels = None
  13. depends_on = None
  14. def upgrade():
  15. op.add_column(
  16. 'users', sa.Column('is_active', sa.Boolean(), default=False, nullable=False)
  17. )
  18. op.add_column(
  19. 'users', sa.Column('created_at', sa.types.DateTime(timezone=True), default=datetime.now(), nullable=False)
  20. )
  21. op.add_column(
  22. 'users', sa.Column('updated_at', sa.types.DateTime(timezone=True), default=datetime.now(), nullable=False)
  23. )
  24. op.add_column(
  25. 'users', sa.Column('hashed_password', sa.String(60), nullable=False)
  26. )
  27. op.add_column(
  28. 'users', sa.Column('email', sa.String(100), nullable=False)
  29. )
  30. op.add_column(
  31. 'users', sa.Column('account', sa.String(50), nullable=False)
  32. )
  33. def downgrade():
  34. op.drop_column('users',
  35. 'is_active'
  36. )
  37. op.drop_column('users',
  38. 'created_at'
  39. )
  40. op.drop_column('users',
  41. 'updated_at'
  42. )
  43. op.drop_column('users',
  44. 'hashed_password'
  45. )
  46. op.drop_column('users',
  47. 'email'
  48. )
  49. op.drop_column('users',
  50. 'account'
  51. )