33 lines
875 B
Python
33 lines
875 B
Python
"""create countrys table
|
|
|
|
Revision ID: 1234567890ab
|
|
Revises:
|
|
Create Date: 2023-06-07 10:00: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(
|
|
'countrys',
|
|
sa.Column('id', UUID(as_uuid=True), primary_key=True),
|
|
sa.Column('name', sa.String, nullable=False, unique=True, index=True),
|
|
sa.Column('code', sa.String(3), nullable=False),
|
|
sa.Column('population', sa.Integer, nullable=False),
|
|
sa.Column('created_at', sa.Integer, server_default=sa.func.now()),
|
|
sa.Column('updated_at', sa.Integer, server_default=sa.func.now(), onupdate=sa.func.now())
|
|
)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_table('countrys') |