diff --git a/app/models.py b/app/models.py index 1a7a8e27..6ab94b81 100644 --- a/app/models.py +++ b/app/models.py @@ -1353,7 +1353,7 @@ class Contact(db.Model, ModelMixin): # This address allows to hide user personal email # this reply email is created every time a website sends an email to user # it has the prefix "reply+" or "ra+" to distinguish with other email - reply_email = db.Column(db.String(512), nullable=False) + reply_email = db.Column(db.String(512), nullable=False, index=True) # whether a contact is created via CC is_cc = db.Column(db.Boolean, nullable=False, default=False, server_default="0") diff --git a/migrations/versions/2021_071310_78403c7b8089_.py b/migrations/versions/2021_071310_78403c7b8089_.py new file mode 100644 index 00000000..e8b82cad --- /dev/null +++ b/migrations/versions/2021_071310_78403c7b8089_.py @@ -0,0 +1,29 @@ +"""empty message + +Revision ID: 78403c7b8089 +Revises: c31a081eab74 +Create Date: 2021-07-13 10:16:51.387510 + +""" +import sqlalchemy_utils +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '78403c7b8089' +down_revision = 'c31a081eab74' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_index(op.f('ix_contact_reply_email'), 'contact', ['reply_email'], unique=False) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index(op.f('ix_contact_reply_email'), table_name='contact') + # ### end Alembic commands ###