Add migration for Artist
This commit is contained in:
parent
f4964f63ab
commit
1dd89a33cc
32
alembic/versions/20250326_065851_4ac2d9ff_create_artist.py
Normal file
32
alembic/versions/20250326_065851_4ac2d9ff_create_artist.py
Normal file
@ -0,0 +1,32 @@
|
||||
"""create artists table
|
||||
|
||||
Revision ID: 1234567890ab
|
||||
Revises:
|
||||
Create Date: 2023-05-24 10:00:00.000000
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects.postgresql import UUID, UUID as PostgresUUID
|
||||
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(
|
||||
'artists',
|
||||
sa.Column('id', PostgresUUID(as_uuid=True), primary_key=True),
|
||||
sa.Column('name', sa.String, nullable=False, unique=True, index=True),
|
||||
sa.Column('country', sa.String, nullable=False, default="Norway"),
|
||||
sa.Column('created_at', PostgresUUID, server_default=func.now()),
|
||||
sa.Column('updated_at', PostgresUUID, onupdate=func.now())
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_table('artists')
|
Loading…
x
Reference in New Issue
Block a user