Add favourite to playlists
This commit is contained in:
parent
9e27418f80
commit
639f006a10
@ -80,6 +80,9 @@ class PlaylistsTable(Model):
|
|||||||
cascade="all, delete-orphan",
|
cascade="all, delete-orphan",
|
||||||
order_by="PlaylistRowsTable.row_number",
|
order_by="PlaylistRowsTable.row_number",
|
||||||
)
|
)
|
||||||
|
favourite: Mapped[bool] = mapped_column(
|
||||||
|
Boolean, nullable=False, index=False, default=False
|
||||||
|
)
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -0,0 +1,58 @@
|
|||||||
|
"""add favouirit to playlists
|
||||||
|
|
||||||
|
Revision ID: 04df697e40cd
|
||||||
|
Revises: 33c04e3c12c8
|
||||||
|
Create Date: 2025-02-22 20:20:45.030024
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import mysql
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '04df697e40cd'
|
||||||
|
down_revision = '33c04e3c12c8'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade(engine_name: str) -> None:
|
||||||
|
globals()["upgrade_%s" % engine_name]()
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade(engine_name: str) -> None:
|
||||||
|
globals()["downgrade_%s" % engine_name]()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade_() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('notecolours', schema=None) as batch_op:
|
||||||
|
batch_op.add_column(sa.Column('strip_substring', sa.Boolean(), nullable=False))
|
||||||
|
batch_op.create_index(batch_op.f('ix_notecolours_substring'), ['substring'], unique=False)
|
||||||
|
|
||||||
|
with op.batch_alter_table('playlist_rows', schema=None) as batch_op:
|
||||||
|
batch_op.drop_constraint('playlist_rows_ibfk_1', type_='foreignkey')
|
||||||
|
|
||||||
|
with op.batch_alter_table('playlists', schema=None) as batch_op:
|
||||||
|
batch_op.add_column(sa.Column('favourite', sa.Boolean(), nullable=False))
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade_() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('playlists', schema=None) as batch_op:
|
||||||
|
batch_op.drop_column('favourite')
|
||||||
|
|
||||||
|
with op.batch_alter_table('playlist_rows', schema=None) as batch_op:
|
||||||
|
batch_op.create_foreign_key('playlist_rows_ibfk_1', 'tracks', ['track_id'], ['id'])
|
||||||
|
|
||||||
|
with op.batch_alter_table('notecolours', schema=None) as batch_op:
|
||||||
|
batch_op.drop_index(batch_op.f('ix_notecolours_substring'))
|
||||||
|
batch_op.drop_column('strip_substring')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user