diff --git a/app/models.py b/app/models.py index 886193a44d..7c7b9a5614 100644 --- a/app/models.py +++ b/app/models.py @@ -448,6 +448,16 @@ def serialize_for_user(self): } +class ReplyToInbox(db.Model): + __tablename__ = "reply_to_inbox" + id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) + inbox = db.Column(db.String, nullable=False) + service = db.relationship(Service) + service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), nullable=False, index=True, unique=False) + created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow) + updated_at = db.Column(db.DateTime, nullable=True, onupdate=datetime.datetime.utcnow) + + class AnnualBilling(db.Model): __tablename__ = "annual_billing" id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, unique=False) diff --git a/migrations/versions/0363_add_reply_to_inbox.py b/migrations/versions/0363_add_reply_to_inbox.py new file mode 100644 index 0000000000..0b8d1d45bb --- /dev/null +++ b/migrations/versions/0363_add_reply_to_inbox.py @@ -0,0 +1,31 @@ +""" + +Revision ID: 0363_add_reply_to_inbox +Revises: 0362_add_service_field +Create Date: 2023-09-20 19:58:37.246845 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +revision = '0363_add_reply_to_inbox' +down_revision = '0362_add_service_field' + + +def upgrade(): + op.create_table('reply_to_inbox', + sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), + sa.Column('inbox', sa.String(), nullable=False), + sa.Column('service_id', postgresql.UUID(as_uuid=True), nullable=False), + sa.Column('created_at', sa.DateTime(), nullable=True), + sa.Column('updated_at', sa.DateTime(), nullable=True), + sa.ForeignKeyConstraint(['service_id'], ['services.id']), + sa.PrimaryKeyConstraint('id') + ) + op.create_index(op.f('ix_reply_to_inbox_service_id'), 'reply_to_inbox', ['service_id'], unique=False) + + +def downgrade(): + op.drop_index(op.f('ix_reply_to_inbox_service_id'), table_name='reply_to_inbox') + op.drop_table('reply_to_inbox')