feat: Add migration for Name table
This commit is contained in:
parent
75d6228cff
commit
7b08ec1553
28
alembic/versions/20250410_142929_6718f124_create_name.py
Normal file
28
alembic/versions/20250410_142929_6718f124_create_name.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
"""create table for names
|
||||||
|
|
||||||
|
Revision ID: 9d7a6b5c4e3f
|
||||||
|
Revises: 2a3b4c5d6e7f
|
||||||
|
Create Date: 2023-05-16 12:00:00.000000
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects.postgresql import UUID
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
# revision identifiers
|
||||||
|
revision = '9d7a6b5c4e3f'
|
||||||
|
down_revision = '2a3b4c5d6e7f'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.create_table(
|
||||||
|
'names',
|
||||||
|
sa.Column('id', UUID(as_uuid=True), primary_key=True, default=uuid.uuid4),
|
||||||
|
sa.Column('name_code', sa.String(), nullable=False, unique=True),
|
||||||
|
sa.Column('created_at', sa.TIMESTAMP, server_default=sa.func.now()),
|
||||||
|
sa.Column('updated_at', sa.TIMESTAMP, server_default=sa.func.now(), onupdate=sa.func.now())
|
||||||
|
)
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.drop_table('names')
|
Loading…
x
Reference in New Issue
Block a user