Further playdates fixes
This commit is contained in:
parent
9bd3a4cf00
commit
65e967d112
@ -216,7 +216,7 @@ class Playdates(Base):
|
|||||||
|
|
||||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
lastplayed = Column(DateTime, index=True, default=None)
|
lastplayed = Column(DateTime, index=True, default=None)
|
||||||
track_id = Column(Integer, ForeignKey('Tracks.id'))
|
track_id = Column(Integer, ForeignKey('tracks.id'))
|
||||||
tracks = relationship("Tracks", back_populates="playdates")
|
tracks = relationship("Tracks", back_populates="playdates")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@ -0,0 +1,34 @@
|
|||||||
|
"""Fixup playdates relationship
|
||||||
|
|
||||||
|
Revision ID: 269a002f989d
|
||||||
|
Revises: 9bf80ba3635f
|
||||||
|
Create Date: 2021-03-28 14:36:59.103846
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import mysql
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '269a002f989d'
|
||||||
|
down_revision = '9bf80ba3635f'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('playdates', sa.Column('track_id', sa.Integer(), nullable=True))
|
||||||
|
op.create_foreign_key(None, 'playdates', 'tracks', ['track_id'], ['id'])
|
||||||
|
op.drop_constraint('tracks_ibfk_1', 'tracks', type_='foreignkey')
|
||||||
|
op.drop_column('tracks', 'playdates_id')
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('tracks', sa.Column('playdates_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True))
|
||||||
|
op.create_foreign_key('tracks_ibfk_1', 'tracks', 'playdates', ['playdates_id'], ['id'])
|
||||||
|
op.drop_constraint(None, 'playdates', type_='foreignkey')
|
||||||
|
op.drop_column('playdates', 'track_id')
|
||||||
|
# ### end Alembic commands ###
|
||||||
Loading…
Reference in New Issue
Block a user