Add migration for Lake
This commit is contained in:
parent
c0c8f47569
commit
1514a96a2e
34
alembic/versions/20250326_065417_00f4ea37_create_lake.py
Normal file
34
alembic/versions/20250326_065417_00f4ea37_create_lake.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
"""create lakes table
|
||||||
|
|
||||||
|
Revision ID: 1234567890ab
|
||||||
|
Revises:
|
||||||
|
Create Date: 2023-05-25 10:00:00.000000
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
import uuid
|
||||||
|
from sqlalchemy.sql import func
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '1234567890ab'
|
||||||
|
down_revision = None
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.create_table(
|
||||||
|
'lakes',
|
||||||
|
sa.Column('id', sa.String, primary_key=True, default=lambda: str(uuid.uuid4())),
|
||||||
|
sa.Column('name', sa.String, nullable=False, index=True),
|
||||||
|
sa.Column('area', sa.Float, nullable=False),
|
||||||
|
sa.Column('depth', sa.Float, nullable=False),
|
||||||
|
sa.Column('location', sa.String, nullable=False),
|
||||||
|
sa.Column('created_at', sa.DateTime, server_default=func.now()),
|
||||||
|
sa.Column('updated_at', sa.DateTime, server_default=func.now(), onupdate=func.now())
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.drop_table('lakes')
|
Loading…
x
Reference in New Issue
Block a user