2022-11-20 01:00:54 -08:00
|
|
|
from sqlalchemy import MetaData
|
|
|
|
from sqlalchemy import Table, Column, Integer, String, UnicodeText, ForeignKey, PrimaryKeyConstraint
|
|
|
|
|
|
|
|
metadata = MetaData()
|
|
|
|
|
|
|
|
track = Table(
|
|
|
|
"track",
|
|
|
|
metadata,
|
|
|
|
Column("id", Integer, primary_key=True, autoincrement=True),
|
|
|
|
Column("relpath", UnicodeText, index=True, unique=True),
|
2022-11-27 18:42:46 -08:00
|
|
|
Column("artist", UnicodeText),
|
|
|
|
Column("title", UnicodeText),
|
2022-11-20 01:00:54 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
playlist = Table(
|
|
|
|
"playlist",
|
|
|
|
metadata,
|
|
|
|
Column("id", Integer, primary_key=True, autoincrement=True),
|
|
|
|
Column("name", String),
|
|
|
|
Column("description", UnicodeText),
|
|
|
|
Column("slug", String, index=True, unique=True),
|
|
|
|
)
|
|
|
|
|
|
|
|
entry = Table(
|
|
|
|
"entry",
|
|
|
|
metadata,
|
|
|
|
Column("track", Integer),
|
|
|
|
Column("playlist_id", Integer, ForeignKey("playlist.id")),
|
|
|
|
Column("track_id", Integer, ForeignKey("track.id")),
|
|
|
|
PrimaryKeyConstraint("playlist_id", "track"),
|
|
|
|
)
|