Skip to content

Commit

Permalink
Add Reply-to Inbox Table (#1459)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsr-rise8 authored Sep 25, 2023
1 parent 17adafa commit dbfe761
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
31 changes: 31 additions & 0 deletions migrations/versions/0363_add_reply_to_inbox.py
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit dbfe761

Please sign in to comment.