Add migration for Alcohol
This commit is contained in:
parent
965185ff5f
commit
7f307f6188
34
alembic/versions/20250325_144430_697f02ac_create_alcohol.py
Normal file
34
alembic/versions/20250325_144430_697f02ac_create_alcohol.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
"""create alcohols table
|
||||||
|
|
||||||
|
Revision ID: 1234567890ab
|
||||||
|
Revises:
|
||||||
|
Create Date: 2023-05-23 15:30:00.000000
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects.postgresql import UUID
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '1234567890ab'
|
||||||
|
down_revision = None
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.create_table(
|
||||||
|
'alcohols',
|
||||||
|
sa.Column('id', UUID(as_uuid=True), primary_key=True, server_default=sa.text("uuid_generate_v4()")),
|
||||||
|
sa.Column('name', sa.String, nullable=False, unique=True),
|
||||||
|
sa.Column('brand', sa.String, nullable=False),
|
||||||
|
sa.Column('alcohol_type', sa.String, nullable=False),
|
||||||
|
sa.Column('alcohol_content', sa.Integer, 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('alcohols')
|
Loading…
x
Reference in New Issue
Block a user