== Entity-Relationship Model v.03 [[Image(ERModel_v03.png, align=center)]] == Entities DESCREPTION OF THE ENTITY/RELATIONSHIP * **Attributes:** * NAME_OF_ATTRIBUTE (TYPE, Required/Optional) - DESCREPTION **1.User:** * **Candidate Keys** * user_id (bigint) - primary key * **Attirbutes** * email (text) * username (bigint) * password (bigint) * date_created (date) **2.Admin:** * **Candidate Keys** * **Attributes:** * type (text) * employee_id (bigint) **3.Consumer** * **Candidate Keys** * **Attributes:** * telephone_number (text) * shipping_address (text) * points_collected (bigint) **4.Wishlist:** * **Candidate Keys** * wishlist_id (bigint) - primary key **5.WishlistItem:** * **Candidate Keys** * wishlist_id (bigint) - foreign key(Wishlist) * product_id (bigint) - foreign key(Product) * **Attributes:** * added_at (date) **6.Product:** * **Candidate Keys** * product_id (bigint) - primary key * **Attributes:** * format (enum) * price (bigint) * description (text) * stock (bigint) **7.Release:** * **Candidate Keys** * release_id (bigint) - primary key * **Attributes:** * title (text) * record_label (text) * genre (text) * release_date (date) * cover_photo (text) **8.Album:** * **Candidate Keys** **9.Single:** * **Candidate Keys** * duration (text) **10.Artist:** * **Candidate Keys** * artist_id (bigint) - primary key * **Attributes:** * artist_name(text) * description(text) * photo (text) **11.Song:** * **Candidate Keys** * song_id(bigint) - primary key * **Attributes:** * song_name(text) * featured_artist (text) * duration (text) **12.OrderItem:** * **Candidate Keys** * order_id (bigint) - foreign key(Order) * product_id (bigint) - foreign key(Product) * **Attributes:** * price_at_purchase (bigint) * quantity (bigint) **13.Order** * **Candidate Keys** * order_id (bigint) - primary key * **Attributes:** * payment_method (enum) * purchase_date (date) * points (bigint) == Relationships * **1.contains** (Album ↔ Song, M:N) Each Album contains Songs, while the same Song can be in multiple albums. * **2.has** (Release ↔ Artist, M:N) Each Artist has multiple releases. * **3.version of ** (Release ↔ Product, 1:N) Each Release can be a different Product. * **4.refers** (Product ↔ OrderItem, 1:N) Each Product can be an OrderItem multiple times. * **5.contains** (OrderItem ↔ Order, N:1) Each Order contains atleast one OrderItem. * **6.creates** (Order ↔ User, N:1) Each User can create multiple Orders. * **7.creates** (Admin ↔ Product, 1:N) Each Admin can create multiple Products. * **8.modifies** (Admin ↔ Product, M:N) Each Admin can modify multiple Products. * **9.has** (Consumer ↔ Wishlist, 1:1) Each Consumer can have a Wishlist * **10.has** (Wishlist ↔ WishlistItem, 1:N) Each Wishlist can contain multiple WishlistItems. * **11.refers** (Wishlist ↔ Product, M:N) Every Product can be a WishlistItem. == Entity-Relationship Model History List of each version, with a one-sentence explanation of the changes in each version, i.e. what was corrected in that version compared to the previous one. If you made the correction at the request of the teacher/assistant based on a ticket posted in the system, you can link to the ticket instead of an explanation.