瀏覽代碼

Remove telegram verification table

JoostSijm 5 年之前
父節點
當前提交
a135bc7617
共有 2 個文件被更改,包括 36 次插入9 次删除
  1. 3 9
      app/models.py
  2. 33 0
      migrations/versions/9524fe8e91f0_remove_telegram_verification.py

+ 3 - 9
app/models.py

@@ -354,6 +354,7 @@ class StateMarketStat(Base):
         backref=backref('state_market_stats', lazy='dynamic')
     )
 
+
 class TelegramAccount(Base):
     """Model for Telegram account"""
     __tablename__ = 'telegram_account'
@@ -361,6 +362,7 @@ class TelegramAccount(Base):
     name = Column(String)
     registration_date = Column(DateTime)
 
+
 class TelegramHandle(Base):
     """Model for Telegram handle"""
     __tablename__ = 'telegram_handle'
@@ -374,6 +376,7 @@ class TelegramHandle(Base):
         backref=backref('account_handles', lazy='dynamic')
     )
 
+
 class PlayerTelegram(Base):
     """Model for belongs to"""
     __tablename__ = 'player_telegram'
@@ -381,12 +384,3 @@ class PlayerTelegram(Base):
     telegram_id = Column(BigInteger, ForeignKey('telegram_account.id'), primary_key=True)
     from_date_time = Column(DateTime, primary_key=True)
     until_date_time = Column(DateTime)
-
-class TelegramVerification(Base):
-    """Model for Telegram verification"""
-    __tablename__ = 'telegram_verification'
-    player_id = Column(BigInteger, ForeignKey('player.id'), primary_key=True)
-    telegram_id = Column(BigInteger, ForeignKey('telegram_account.id'), primary_key=True)
-    code = Column(String)
-    date_time = Column(DateTime)
-    confirmed = Column(Boolean, server_default='f', default=False)

+ 33 - 0
migrations/versions/9524fe8e91f0_remove_telegram_verification.py

@@ -0,0 +1,33 @@
+"""remove telegram verification
+
+Revision ID: 9524fe8e91f0
+Revises: 97d0cf5e4bb0
+Create Date: 2020-02-11 00:03:26.671954
+
+"""
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects import postgresql
+
+# revision identifiers, used by Alembic.
+revision = '9524fe8e91f0'
+down_revision = '97d0cf5e4bb0'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+    op.drop_table('telegram_verification')
+
+
+def downgrade():
+    op.create_table('telegram_verification',
+    sa.Column('player_id', sa.BIGINT(), autoincrement=False, nullable=False),
+    sa.Column('telegram_id', sa.BIGINT(), autoincrement=False, nullable=False),
+    sa.Column('code', sa.VARCHAR(), autoincrement=False, nullable=True),
+    sa.Column('date_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
+    sa.Column('confirmed', sa.BOOLEAN(), server_default=sa.text('false'), autoincrement=False, nullable=True),
+    sa.ForeignKeyConstraint(['player_id'], ['player.id'], name='fk_telegram_verification_player_id_player'),
+    sa.ForeignKeyConstraint(['telegram_id'], ['telegram_account.id'], name='fk_telegram_verification_telegram_id_telegram_account'),
+    sa.PrimaryKeyConstraint('player_id', 'telegram_id', name='pk_telegram_verification')
+    )