app-MAIL-temp/migrations/versions/2022_072119_c66f2c5b6cb1_.py
Son Nguyen Kim 6322e03996
admin can manage newsletter and test sending it (#1177)
* admin can manage newsletter and test sending it

* add comments

* comment

* doc

* not userID not specified, send the newsletter to current user

* automatically match textarea height to content when editing newsletter

* increase text height and limit img size to 100% in email template

* admin can send newsletter to a specific address
2022-07-22 11:24:53 +02:00

52 lines
1.9 KiB
Python

"""empty message
Revision ID: c66f2c5b6cb1
Revises: 89081a00fc7d
Create Date: 2022-07-21 19:06:38.330239
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c66f2c5b6cb1'
down_revision = '89081a00fc7d'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('newsletter',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
sa.Column('subject', sa.String(), nullable=False),
sa.Column('html', sa.Text(), nullable=True),
sa.Column('plain_text', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_newsletter_subject'), 'newsletter', ['subject'], unique=True)
op.create_table('newsletter_user',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('newsletter_id', sa.Integer(), nullable=True),
sa.Column('sent_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
sa.ForeignKeyConstraint(['newsletter_id'], ['newsletter.id'], ondelete='cascade'),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='cascade'),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('newsletter_user')
op.drop_index(op.f('ix_newsletter_subject'), table_name='newsletter')
op.drop_table('newsletter')
# ### end Alembic commands ###