31 lines
883 B
Python
31 lines
883 B
Python
"""create table for contacts
|
|
|
|
Revision ID: 2a3b4c5d6e7f
|
|
Revises: 0001
|
|
Create Date: 2023-05-26 12:34:56
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects.sqlite import UUID
|
|
import uuid
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '2a3b4c5d6e7f'
|
|
down_revision = '0001'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
def upgrade():
|
|
op.create_table(
|
|
'contacts',
|
|
sa.Column('id', UUID(as_uuid=True), primary_key=True, default=uuid.uuid4),
|
|
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(), onupdate=sa.func.now())
|
|
)
|
|
|
|
def downgrade():
|
|
op.drop_table('contacts') |