1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-10 04:02:17 +00:00

Reduced some columns size from 256 to 255

Was causing error while creating tables on some MySQL servers.
Especially the 'artist.name' column which is unique.
This commit is contained in:
spl0k 2014-03-01 19:25:40 +01:00
parent d2b2f2420b
commit e84af9d661

16
db.py
View File

@ -68,7 +68,7 @@ class User(Base):
id = UUID.gen_id_column() id = UUID.gen_id_column()
name = Column(String(64), unique = True) name = Column(String(64), unique = True)
mail = Column(String(256)) mail = Column(String(255))
password = Column(String(40)) password = Column(String(40))
salt = Column(String(6)) salt = Column(String(6))
admin = Column(Boolean, default = False) admin = Column(Boolean, default = False)
@ -110,7 +110,7 @@ class Folder(Base):
id = UUID.gen_id_column() id = UUID.gen_id_column()
root = Column(Boolean, default = False) root = Column(Boolean, default = False)
name = Column(String(256)) name = Column(String(255))
path = Column(String(4096)) # should be unique, but mysql don't like such large columns path = Column(String(4096)) # should be unique, but mysql don't like such large columns
created = Column(DateTime, default = now) created = Column(DateTime, default = now)
has_cover_art = Column(Boolean, default = False) has_cover_art = Column(Boolean, default = False)
@ -150,7 +150,7 @@ class Artist(Base):
__tablename__ = 'artist' __tablename__ = 'artist'
id = UUID.gen_id_column() id = UUID.gen_id_column()
name = Column(String(256), unique = True) name = Column(String(255), unique = True)
albums = relationship('Album', backref = 'artist') albums = relationship('Album', backref = 'artist')
def as_subsonic_artist(self, user): def as_subsonic_artist(self, user):
@ -171,7 +171,7 @@ class Album(Base):
__tablename__ = 'album' __tablename__ = 'album'
id = UUID.gen_id_column() id = UUID.gen_id_column()
name = Column(String(256)) name = Column(String(255))
artist_id = Column(UUID, ForeignKey('artist.id')) artist_id = Column(UUID, ForeignKey('artist.id'))
tracks = relationship('Track', backref = 'album') tracks = relationship('Track', backref = 'album')
@ -204,9 +204,9 @@ class Track(Base):
id = UUID.gen_id_column() id = UUID.gen_id_column()
disc = Column(Integer) disc = Column(Integer)
number = Column(Integer) number = Column(Integer)
title = Column(String(256)) title = Column(String(255))
year = Column(Integer, nullable = True) year = Column(Integer, nullable = True)
genre = Column(String(256), nullable = True) genre = Column(String(255), nullable = True)
duration = Column(Integer) duration = Column(Integer)
album_id = Column(UUID, ForeignKey('album.id')) album_id = Column(UUID, ForeignKey('album.id'))
bitrate = Column(Integer) bitrate = Column(Integer)
@ -369,8 +369,8 @@ class Playlist(Base):
id = UUID.gen_id_column() id = UUID.gen_id_column()
user_id = Column(UUID, ForeignKey('user.id')) user_id = Column(UUID, ForeignKey('user.id'))
name = Column(String(256)) name = Column(String(255))
comment = Column(String(256), nullable = True) comment = Column(String(255), nullable = True)
public = Column(Boolean, default = False) public = Column(Boolean, default = False)
created = Column(DateTime, default = now) created = Column(DateTime, default = now)