32 lines
859 B
Python
32 lines
859 B
Python
"""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') |