Add term column
This commit is contained in:
parent
b5e2e8ab2a
commit
377462ed20
5 changed files with 100 additions and 1 deletions
35
migrations/versions/b1c2d3e4f5a6_add_terms.py
Normal file
35
migrations/versions/b1c2d3e4f5a6_add_terms.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
"""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")
|
||||
Loading…
Add table
Add a link
Reference in a new issue