35 lines
819 B
Python
35 lines
819 B
Python
"""add terms table and term_id to tune_by_instrument
|
|
|
|
Revision ID: b1c2d3e4f5a6
|
|
Revises: f1a2b3c4d5e6
|
|
Create Date: 2026-06-09
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "b1c2d3e4f5a6"
|
|
down_revision = "f1a2b3c4d5e6"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"terms",
|
|
sa.Column("id", sa.Integer(), primary_key=True, autoincrement=True),
|
|
sa.Column("name", sa.String(), nullable=False, unique=True),
|
|
)
|
|
op.add_column(
|
|
"tune_by_instrument",
|
|
sa.Column(
|
|
"term_id",
|
|
sa.Integer(),
|
|
sa.ForeignKey("terms.id", ondelete="SET NULL"),
|
|
nullable=True,
|
|
),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("tune_by_instrument", "term_id")
|
|
op.drop_table("terms")
|