mirror of
https://github.com/GSA/notifications-api.git
synced 2026-04-03 09:00:13 -04:00
Create InboundSmsHistory model and table
This commit is contained in:
@@ -1898,6 +1898,18 @@ class InboundSms(db.Model):
|
||||
}
|
||||
|
||||
|
||||
class InboundSmsHistory(db.Model, HistoryModel):
|
||||
__tablename__ = 'inbound_sms_history'
|
||||
id = db.Column(UUID(as_uuid=True), primary_key=True)
|
||||
created_at = db.Column(db.DateTime, nullable=False)
|
||||
service_id = db.Column(UUID(as_uuid=True), db.ForeignKey('services.id'), index=True, unique=False)
|
||||
service = db.relationship('Service', backref='inbound_sms_history') # what does this one do?
|
||||
notify_number = db.Column(db.String, nullable=False)
|
||||
provider_date = db.Column(db.DateTime)
|
||||
provider_reference = db.Column(db.String)
|
||||
provider = db.Column(db.String, nullable=False)
|
||||
|
||||
|
||||
class LetterRate(db.Model):
|
||||
__tablename__ = 'letter_rates'
|
||||
|
||||
|
||||
37
migrations/versions/0311_add_inbound_sms_history.py
Normal file
37
migrations/versions/0311_add_inbound_sms_history.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""
|
||||
|
||||
Revision ID: 0311_add_inbound_sms_history
|
||||
Revises: 0310_returned_letters_table
|
||||
Create Date: 2019-12-17 11:02:17.572689
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = '0311_add_inbound_sms_history'
|
||||
down_revision = '0310_returned_letters_table'
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('inbound_sms_history',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('service_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('notify_number', sa.String(), nullable=False),
|
||||
sa.Column('provider_date', sa.DateTime(), nullable=True),
|
||||
sa.Column('provider_reference', sa.String(), nullable=True),
|
||||
sa.Column('provider', sa.String(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_inbound_sms_history_service_id'), 'inbound_sms_history', ['service_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_inbound_sms_history_service_id'), table_name='inbound_sms_history')
|
||||
op.drop_table('inbound_sms_history')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user