grooveondemand/groove/db/schema.py

30 lines
809 B
Python
Raw Normal View History

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),
)
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"),
)