diff --git a/app/models/plan.py b/app/models/plan.py index ca9b229..e101421 100644 --- a/app/models/plan.py +++ b/app/models/plan.py @@ -9,7 +9,7 @@ from app.database import db class Plan(db.Model): """Plan model for user subscription plans.""" - __tablename__ = "plans" + __tablename__ = "plan" id = Column(Integer, primary_key=True) code = Column(String(50), unique=True, nullable=False, index=True) diff --git a/app/models/playlist.py b/app/models/playlist.py index 2814384..063b975 100644 --- a/app/models/playlist.py +++ b/app/models/playlist.py @@ -17,14 +17,14 @@ if TYPE_CHECKING: class Playlist(db.Model): """Model for playlists containing sounds.""" - __tablename__ = "playlists" + __tablename__ = "playlist" id: Mapped[int] = mapped_column(Integer, primary_key=True) name: Mapped[str] = mapped_column(String(255), nullable=False) description: Mapped[Optional[str]] = mapped_column(Text, nullable=True) genre: Mapped[Optional[str]] = mapped_column(String(100), nullable=True) user_id: Mapped[Optional[int]] = mapped_column( - Integer, ForeignKey("users.id"), nullable=True + Integer, ForeignKey("user.id"), nullable=True ) is_main: Mapped[bool] = mapped_column( Boolean, default=False, nullable=False diff --git a/app/models/playlist_sound.py b/app/models/playlist_sound.py index 9dc0d65..eaa89ff 100644 --- a/app/models/playlist_sound.py +++ b/app/models/playlist_sound.py @@ -17,14 +17,14 @@ if TYPE_CHECKING: class PlaylistSound(db.Model): """Model for playlist-sound relationships with ordering.""" - __tablename__ = "playlist_sounds" + __tablename__ = "playlist_sound" id: Mapped[int] = mapped_column(Integer, primary_key=True) playlist_id: Mapped[int] = mapped_column( - Integer, ForeignKey("playlists.id"), nullable=False + Integer, ForeignKey("playlist.id"), nullable=False ) sound_id: Mapped[int] = mapped_column( - Integer, ForeignKey("sounds.id"), nullable=False + Integer, ForeignKey("sound.id"), nullable=False ) order: Mapped[int] = mapped_column(Integer, nullable=False) added_at: Mapped[datetime] = mapped_column( diff --git a/app/models/sound.py b/app/models/sound.py index ecfa5e8..b23539a 100644 --- a/app/models/sound.py +++ b/app/models/sound.py @@ -25,7 +25,7 @@ class SoundType(Enum): class Sound(db.Model): """Sound model for storing sound file information.""" - __tablename__ = "sounds" + __tablename__ = "sound" id: Mapped[int] = mapped_column(primary_key=True) diff --git a/app/models/sound_played.py b/app/models/sound_played.py index b8b48e1..6b82d06 100644 --- a/app/models/sound_played.py +++ b/app/models/sound_played.py @@ -19,12 +19,12 @@ class SoundPlayed(db.Model): # Foreign keys user_id: Mapped[int] = mapped_column( Integer, - ForeignKey("users.id"), + ForeignKey("user.id"), nullable=False, ) sound_id: Mapped[int] = mapped_column( Integer, - ForeignKey("sounds.id"), + ForeignKey("sound.id"), nullable=False, ) diff --git a/app/models/user.py b/app/models/user.py index 3a9bebf..2869717 100644 --- a/app/models/user.py +++ b/app/models/user.py @@ -20,7 +20,7 @@ if TYPE_CHECKING: class User(db.Model): """User model for storing user information.""" - __tablename__ = "users" + __tablename__ = "user" id: Mapped[int] = mapped_column(primary_key=True) @@ -48,7 +48,7 @@ class User(db.Model): # Plan relationship plan_id: Mapped[int] = mapped_column( Integer, - ForeignKey("plans.id"), + ForeignKey("plan.id"), nullable=False, ) diff --git a/app/models/user_oauth.py b/app/models/user_oauth.py index b987e72..a7872f0 100644 --- a/app/models/user_oauth.py +++ b/app/models/user_oauth.py @@ -21,7 +21,7 @@ class UserOAuth(db.Model): id: Mapped[int] = mapped_column(primary_key=True) # User relationship - user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), nullable=False) + user_id: Mapped[int] = mapped_column(ForeignKey("user.id"), nullable=False) # OAuth provider information provider: Mapped[str] = mapped_column(String(50), nullable=False)