| 19 | | * **Candidate Keys:** |
| 20 | | * NAME_OF_KEY (TYPE OF KEY) |
| | 19 | * **1.User:** |
| | 20 | * user_id (bigint) - primary key |
| | 21 | * email (text) |
| | 22 | * username (bigint) |
| | 23 | * password (bigint) |
| | 24 | * date_created (date) |
| | 25 | |
| | 26 | * **2.Admin:** |
| | 27 | * type (text) |
| | 28 | * employee_id (bigint) |
| | 29 | |
| | 30 | * **3.Consumer:** |
| | 31 | * telephone_number (text) |
| | 32 | * shipping_address (text) |
| | 33 | * points_collected (bigint) |
| | 34 | |
| | 35 | * **4.Wishlist:** |
| | 36 | * wishlist_id (bigint) - primary key |
| | 37 | |
| | 38 | * **5.WishlistItem:** |
| | 39 | * wishlist_id (bigint) - foreign key(Wishlist) |
| | 40 | * product_id (bigint) - foreign key(Product) |
| | 41 | * added_at (date) |
| | 42 | |
| | 43 | * **6.Product:** |
| | 44 | * product_id (bigint) - primary key |
| | 45 | * format (enum) |
| | 46 | * price (bigint) |
| | 47 | * description (text) |
| | 48 | * stock (bigint) |
| | 49 | |
| | 50 | * **7.Release:** |
| | 51 | * release_id (bigint) - primary key |
| | 52 | * title (text) |
| | 53 | * record_label (text) |
| | 54 | * genre (text) |
| | 55 | * release_date (date) |
| | 56 | * cover_photo (text) |
| | 57 | |
| | 58 | * **8.Album:** |
| | 59 | |
| | 60 | * **9.Single:** |
| | 61 | * duration (text) |
| | 62 | |
| | 63 | * **10.Artist:** |
| | 64 | * artist_id (bigint) - primary key |
| | 65 | * artist_name(text) |
| | 66 | * description(text) |
| | 67 | * photo (text) |
| | 68 | |
| | 69 | * **11.Song:** |
| | 70 | * song_id(bigint) - primary key |
| | 71 | * song_name(text) |
| | 72 | * featured_artist (text) |
| | 73 | * duration (text) |
| | 74 | |
| | 75 | * **12.OrderItem:** |
| | 76 | * order_id (bigint) - foreign key(Order) |
| | 77 | * product_id (bigint) - foreign key(Product) |
| | 78 | * price_at_purchase (bigint) |
| | 79 | * quantity (bigint) |
| | 80 | |
| | 81 | * **13.Order:** |
| | 82 | * order_id (bigint) - primary key |
| | 83 | * payment_method (enum) |
| | 84 | * purchase_date (date) |
| | 85 | * points (bigint) |
| | 86 | |
| | 87 | |
| | 88 | |
| | 89 | |
| | 96 | |
| | 97 | * **1.contains** (Album ↔ Song, M:N) |
| | 98 | Each Album contains Songs, while the same Song can be in multiple albums. |
| | 99 | |
| | 100 | * **2.has** (Release ↔ Artist, M:N) |
| | 101 | Each Artist has multiple releases. |
| | 102 | |
| | 103 | * **3.version of ** (Release ↔ Product, 1:N) |
| | 104 | Each Release can be a different Product. |
| | 105 | |
| | 106 | * **4.refers** (Product ↔ OrderItem, 1:N) |
| | 107 | Each Product can be an OrderItem multiple times. |
| | 108 | |
| | 109 | * **5.contains** (OrderItem ↔ Order, N:1) |
| | 110 | Each Order contains atleast one OrderItem. |
| | 111 | |
| | 112 | * **6.creates** (Order ↔ User, N:1) |
| | 113 | Each User can create multiple Orders. |
| | 114 | |
| | 115 | * **7.creates** (Admin ↔ Product, 1:N) |
| | 116 | Each Admin can create multiple Products. |
| | 117 | |
| | 118 | * **8.modifies** (Admin ↔ Product, M:N) |
| | 119 | Each Admin can modify multiple Products. |
| | 120 | |
| | 121 | * **9.has** (Consumer ↔ Wishlist, 1:1) |
| | 122 | Each Consumer can have a Wishlist |
| | 123 | |
| | 124 | * **10.has** (Wishlist ↔ WishlistItem, 1:N) |
| | 125 | Each Wishlist can contain multiple WishlistItems. |
| | 126 | |
| | 127 | * **11.refers** (Wishlist ↔ Product, M:N) |
| | 128 | Every Product can be a WishlistItem. |
| | 129 | |