-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Matsadura/db_models
[UPDATE] Change DB Schema
- Loading branch information
Showing
8 changed files
with
54 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env python3 | ||
"""Holds class Movie""" | ||
from models.base_model import BaseModel, Base | ||
from sqlalchemy import Column, String | ||
from sqlalchemy.orm import relationship | ||
|
||
|
||
class Movie(BaseModel, Base): | ||
"""Representation of a user """ | ||
__tablename__ = 'movies' | ||
movie = Column(String(60), nullable=False) | ||
user_movies = relationship("User_Movie", | ||
back_populates="movie", | ||
cascade="all, delete-orphan") | ||
|
||
def __init__(self, *args, **kwargs): | ||
"""Initializes user""" | ||
super().__init__(*args, **kwargs) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python3 | ||
"""Holds class User_Movie""" | ||
from models.base_model import BaseModel, Base | ||
from sqlalchemy import Column, String, Boolean, ForeignKey | ||
from sqlalchemy.orm import relationship | ||
|
||
|
||
class User_Movie(BaseModel, Base): | ||
"""Representation of a vault """ | ||
__tablename__ = 'user_movies' | ||
user_id = Column(String(128), | ||
ForeignKey('users.id', ondelete='CASCADE'), | ||
nullable=False) | ||
movie_id = Column(String(128), | ||
ForeignKey('movies.id', ondelete='CASCADE'), | ||
nullable=False) | ||
seen = Column(Boolean, nullable=True) | ||
like = Column(Boolean, nullable=True) | ||
movie = relationship("Movie", back_populates="user_movies") | ||
user = relationship("User", back_populates="user_movies",) | ||
|
||
def __init__(self, *args, **kwargs): | ||
"""initializes vault""" | ||
super().__init__(*args, **kwargs) |