-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app: create separate object for draft/pending/failed replies
- Loading branch information
1 parent
950b9c3
commit e55e45f
Showing
9 changed files
with
166 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
"""add reply draft | ||
Revision ID: 86b01b6290da | ||
Revises: 36a79ffcfbfb | ||
Create Date: 2019-10-17 09:45:07.643076 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '86b01b6290da' | ||
down_revision = '36a79ffcfbfb' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.create_table('replysendstatuses', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('name', sa.String(length=36), nullable=False), | ||
sa.PrimaryKeyConstraint('id', name=op.f('pk_replysendstatuses')), | ||
sa.UniqueConstraint('name', name=op.f('uq_replysendstatuses_name')) | ||
) | ||
|
||
# Set the initial in-progress send statuses: PENDING, FAILED | ||
conn = op.get_bind() | ||
conn.execute(''' | ||
INSERT INTO replysendstatuses | ||
('name') | ||
VALUES | ||
('PENDING'), | ||
('FAILED'); | ||
''') | ||
|
||
op.create_table( | ||
'draftreplies', | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('uuid', sa.String(length=36), nullable=False), | ||
sa.Column('timestamp', sa.DateTime(), nullable=False), | ||
sa.Column('source_id', sa.Integer(), nullable=False), | ||
sa.Column('journalist_id', sa.Integer(), nullable=True), | ||
sa.Column('file_counter', sa.Integer(), nullable=False), | ||
sa.Column('content', sa.Text(), nullable=True), | ||
sa.Column('send_status_id', sa.Integer(), nullable=True), | ||
sa.PrimaryKeyConstraint('id', name=op.f('pk_draftreplies')), | ||
sa.UniqueConstraint('uuid', name=op.f('uq_draftreplies_uuid')), | ||
sa.ForeignKeyConstraint( | ||
['source_id'], | ||
['sources.id'], | ||
name=op.f('fk_draftreplies_source_id_sources')), | ||
sa.ForeignKeyConstraint( | ||
['journalist_id'], | ||
['users.id'], | ||
name=op.f('fk_draftreplies_journalist_id_users')), | ||
sa.ForeignKeyConstraint( | ||
['send_status_id'], | ||
['replysendstatuses.id'], | ||
op.f('fk_draftreplies_send_status_id_replysendstatuses'), | ||
) | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_table('draftreplies') | ||
op.drop_table('replysendstatuses') |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.