29 lines
830 B
Python
29 lines
830 B
Python
"""create table for fruits
|
|
Revision ID: 3a7d6c1e86b4
|
|
Revises: 0001
|
|
Create Date: 2023-05-25 11:36:06.526501
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
import uuid
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '3a7d6c1e86b4'
|
|
down_revision = '0001'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
def upgrade():
|
|
table_name = "fruits"
|
|
|
|
op.create_table(
|
|
table_name,
|
|
sa.Column('id', sa.String(36), primary_key=True, default=lambda: str(uuid.uuid4())),
|
|
sa.Column('name', sa.String(), nullable=False, unique=True),
|
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.func.now()),
|
|
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now())
|
|
)
|
|
|
|
def downgrade():
|
|
table_name = "fruits"
|
|
op.drop_table(table_name) |