-
Notifications
You must be signed in to change notification settings - Fork 0
Database Schema Documentation
DeepBlockDeepak edited this page Nov 27, 2023
·
2 revisions
This documentation provides an overview of the database schema used in the Flask application, focusing on the models, their relationships, and the design rationale behind them.
- Description: Represents a user of the application.
-
Attributes:
-
id: Primary key. -
username: Unique username. -
email: Unique email address. -
password_hash: Hashed password for security. -
budget: Stores the user's budget. -
joined_at: Timestamp of account creation.
-
-
Relationships:
- Linked to
Favoritelist,Searchlist, andTravellistvia foreign keys. - One-to-many relationship with
Blurb.
- Linked to
- Description: Represents a city or location.
-
Attributes:
-
id: Primary key. -
city: City name. -
state: State name. -
population: Population of the city. -
activities: Activities available in the city. -
wiki: Wikipedia content related to the city. -
times_favorited: Count of how many times favorited. -
times_searched: Count of how many times searched.
-
-
Relationships:
- Many-to-many relationship with
UserthroughFavoriteitemandSearchitem.
- Many-to-many relationship with
- Description: Allows users to write short messages or "tweets."
-
Attributes:
-
id: Primary key. -
content: Content of the blurb. -
author_id: Foreign key toUser.
-
-
Description: Junction tables for the many-to-many relationships between
UserandPlace. -
Attributes:
-
id: Primary key. -
place_id: Foreign key toPlace. -
favoritelist_id/searchlist_id: Foreign key toFavoritelist/Searchlist.
-
- Description: Represents a trip between two locations.
-
Attributes:
-
id: Primary key. -
origin_place_id: Foreign key toPlace(origin). -
destination_place_id: Foreign key toPlace(destination). -
price: Cost of the trip.
-
-
Relationships:
- Many-to-many relationship with
PlacethroughTravelplaceitem.
- Many-to-many relationship with
- Description: Represents lists associated with a user.
-
Attributes:
-
id: Primary key.
-
-
Relationships:
- One-to-many relationships with their respective item models.
-
Abstraction of Relationships: Each *item class, such as Travelplaceitem, serves as a junction table in the database. It abstracts the relationship between a Place and a list (e.g., a list of travel destinations).
- By using these abstract classes, you gain the flexibility to add or remove places from various lists without affecting the Place entities themselves. For instance, if a User decides to remove a Place from their travel itinerary, only the corresponding Travelplaceitem entity is removed. The Place entity remains intact in the database, potentially still linked to other lists or users.