stream-project-ycnpdj/alembic/versions/20250414_154332_c226552d_update_fruit.py

28 lines
814 B
Python

"""Initial creation of fruits table
Revision ID: 1a2b3c4d5e6f
Revises: 0001
Create Date: 2024-01-20 10:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1a2b3c4d5e6f'
down_revision = '0001'
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
'fruits',
sa.Column('id', sa.String(36), primary_key=True),
sa.Column('name', sa.String(), 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_fruits_name'), 'fruits', ['name'], unique=True)
def downgrade():
op.drop_index(op.f('ix_fruits_name'), table_name='fruits')
op.drop_table('fruits')