Add database seeding functionality and enhance model relationships
- Implement initial data seeding for plans in the database. - Create a new `seed_all_data` function to manage seeding process. - Update `Sound` and `User` models to include relationships for `SoundPlayed` and `Stream`.
This commit is contained in:
@@ -6,6 +6,7 @@ from app.models.base import BaseModel
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from app.models.playlist_sound import PlaylistSound
|
||||
from app.models.sound_played import SoundPlayed
|
||||
from app.models.stream import Stream
|
||||
|
||||
|
||||
@@ -31,3 +32,4 @@ class Sound(BaseModel, table=True):
|
||||
# relationships
|
||||
playlist_sounds: list["PlaylistSound"] = Relationship(back_populates="sound")
|
||||
streams: list["Stream"] = Relationship(back_populates="sound")
|
||||
play_history: list["SoundPlayed"] = Relationship(back_populates="sound")
|
||||
|
||||
Reference in New Issue
Block a user