32 lines
953 B
Python
32 lines
953 B
Python
"""create contact_forms table
|
|
Revision ID: 0002
|
|
Revises: 0001
|
|
Create Date: 2023-07-15 12:00:00.000000
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '0002'
|
|
down_revision = '0001'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
op.create_table(
|
|
'contact_forms',
|
|
sa.Column('id', sa.String(36), primary_key=True),
|
|
sa.Column('name', sa.String(), nullable=False),
|
|
sa.Column('email', sa.String(), nullable=False),
|
|
sa.Column('message', sa.Text(), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now()),
|
|
sa.Column('updated_at', sa.DateTime(), server_default=sa.func.now())
|
|
)
|
|
op.create_index(op.f('ix_contact_forms_email'), 'contact_forms', ['email'], unique=False)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_index(op.f('ix_contact_forms_email'), table_name='contact_forms')
|
|
op.drop_table('contact_forms') |