|
| 1 | +"""new-email-queue |
| 2 | +
|
| 3 | +Revision ID: d64e9ebd0253 |
| 4 | +Revises: 4594b458279c |
| 5 | +Create Date: 2025-11-20 14:30:18.888335 |
| 6 | +
|
| 7 | +""" |
| 8 | +from typing import Sequence, Union |
| 9 | + |
| 10 | +from alembic import op |
| 11 | +import sqlalchemy as sa |
| 12 | +import sqlmodel |
| 13 | + |
| 14 | + |
| 15 | +# revision identifiers, used by Alembic. |
| 16 | +revision: str = 'd64e9ebd0253' |
| 17 | +down_revision: Union[str, None] = '4594b458279c' |
| 18 | +branch_labels: Union[str, Sequence[str], None] = None |
| 19 | +depends_on: Union[str, Sequence[str], None] = None |
| 20 | + |
| 21 | + |
| 22 | +def upgrade() -> None: |
| 23 | + # ### commands auto generated by Alembic - please adjust! ### |
| 24 | + op.create_table('emailnotification', |
| 25 | + sa.Column('id', sa.Uuid(), nullable=False), |
| 26 | + sa.Column('to_address', sqlmodel.sql.sqltypes.AutoString(), nullable=False), |
| 27 | + sa.Column('subject', sqlmodel.sql.sqltypes.AutoString(), nullable=False), |
| 28 | + sa.Column('body_html', sa.Text(), nullable=False), |
| 29 | + sa.Column('status', sa.Enum('PENDING', 'SENDING', 'SENT', 'FAILED', name='EmailStatusEnum'), nullable=False), |
| 30 | + sa.Column('attempts', sa.Integer(), nullable=False), |
| 31 | + sa.Column('last_error', sa.String(length=1024), nullable=True), |
| 32 | + sa.Column('send_after', sa.DateTime(timezone=True), nullable=True), |
| 33 | + sa.Column('sent_at', sa.DateTime(timezone=True), nullable=True), |
| 34 | + sa.Column('created_at', sa.DateTime(timezone=True), nullable=False), |
| 35 | + sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False), |
| 36 | + sa.PrimaryKeyConstraint('id', name=op.f('pk_emailnotification')) |
| 37 | + ) |
| 38 | + op.create_index(op.f('ix_emailnotification_status'), 'emailnotification', ['status'], unique=False) |
| 39 | + op.create_index(op.f('ix_emailnotification_to_address'), 'emailnotification', ['to_address'], unique=False) |
| 40 | + # ### end Alembic commands ### |
| 41 | + |
| 42 | + |
| 43 | +def downgrade() -> None: |
| 44 | + # ### commands auto generated by Alembic - please adjust! ### |
| 45 | + op.drop_index(op.f('ix_emailnotification_to_address'), table_name='emailnotification') |
| 46 | + op.drop_index(op.f('ix_emailnotification_status'), table_name='emailnotification') |
| 47 | + op.drop_table('emailnotification') |
| 48 | + # ### end Alembic commands ### |
0 commit comments