Don't allow duplicate track paths
This commit is contained in:
parent
503ba36a88
commit
5f8d8572ad
@ -508,7 +508,7 @@ class Tracks(Base):
|
||||
start_gap = Column(Integer, index=False)
|
||||
fade_at = Column(Integer, index=False)
|
||||
silence_at = Column(Integer, index=False)
|
||||
path = Column(String(2048), index=False, nullable=False)
|
||||
path = Column(String(2048), index=False, nullable=False, unique=True)
|
||||
mtime = Column(Float, index=True)
|
||||
playlistrows = relationship("PlaylistRows", back_populates="track")
|
||||
playlists = association_proxy("playlistrows", "playlist")
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
"""Don't allow duplicate track paths
|
||||
|
||||
Revision ID: fe2e127b3332
|
||||
Revises: 0c604bf490f8
|
||||
Create Date: 2022-08-21 19:46:35.768659
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'fe2e127b3332'
|
||||
down_revision = '0c604bf490f8'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_unique_constraint(None, 'tracks', ['path'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'tracks', type_='unique')
|
||||
# ### end Alembic commands ###
|
||||
Loading…
Reference in New Issue
Block a user