Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New db schema #120

Merged
merged 53 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
9dc4641
use datetime for review `date`
creme332 Apr 20, 2024
d595b9f
create new version v1 of erd
creme332 Apr 20, 2024
46ed961
add background color to v1
creme332 Apr 20, 2024
8636784
add total participation: comment-writes, review-writes
creme332 Apr 20, 2024
1704945
create a store model
creme332 Apr 21, 2024
7ee6bc0
create Location model
creme332 Apr 21, 2024
e3b6f9a
implement new version v1 of erd
creme332 Apr 21, 2024
7187b0b
- replace latitude and longitude with a coordinate of type point
creme332 Apr 21, 2024
0ccf800
update diagrams based on v1 schema
creme332 Apr 21, 2024
1730ec7
create comment model
creme332 Apr 21, 2024
410a970
rename `user_id` to `client_id` in order table
creme332 Apr 21, 2024
54706f2
refactor getByID, add phpdoc for save()
creme332 Apr 21, 2024
3f507c4
update attributes based on new db schema, update signature of constru…
creme332 Apr 21, 2024
bce3cba
new constructor, complete save(), fix bug in toArray
creme332 Apr 21, 2024
40c09dd
add toArray(), store only district_id
creme332 Apr 21, 2024
5674b86
refactor getByID
creme332 Apr 21, 2024
fc70aa8
remove stock level, add created_date attribute
creme332 Apr 22, 2024
2ab73ce
change return type of save() to bool
creme332 Apr 22, 2024
f321fcf
add stringToDate function
creme332 Apr 22, 2024
3d6dafd
- store unit price in order_product relationship
creme332 Apr 23, 2024
3e71d6c
handle case where table names are reserved sql keywords
creme332 Apr 23, 2024
92127c9
create OrderProduct model
creme332 Apr 23, 2024
3f9620c
rework order model based on new db schema
creme332 Apr 23, 2024
6bcda66
- add unit_price to order_product
creme332 Apr 23, 2024
d2222e7
refactor
creme332 Apr 23, 2024
3a0ff69
fix bugs
creme332 Apr 23, 2024
aa9a7fd
make improvements to UI
creme332 Apr 23, 2024
b6be5f6
make getFullName static
creme332 Apr 23, 2024
bcb41ea
make getNestedComments operational
creme332 Apr 23, 2024
d4ccb84
no need to call function to get full name
creme332 Apr 23, 2024
995093b
fix bug for review_id in toArray
creme332 Apr 23, 2024
29c3b89
make nested comments work
creme332 Apr 23, 2024
67e03a8
remove unused import
creme332 Apr 23, 2024
a894542
make nesting indentation dynamic
creme332 Apr 23, 2024
8006f17
fix date bug in getByID
creme332 Apr 23, 2024
4019508
handle case where modal components (close button) are null
creme332 Apr 23, 2024
251b263
rename file, init comment form modal
creme332 Apr 23, 2024
a2ebb32
display comment form when reply button is clicked
creme332 Apr 23, 2024
32a2818
handle comment submission
creme332 Apr 23, 2024
4240948
init modals after dom has loaded
creme332 Apr 23, 2024
1ffc7b5
show error messages in comment form
creme332 Apr 23, 2024
fc29bbb
add getFormattedAddress
creme332 Apr 23, 2024
da7fa1f
display store options on shopping cart page
creme332 Apr 23, 2024
6b787d7
add `getAll`, rename Id to ID
creme332 Apr 23, 2024
ed0f00e
- remove client data
creme332 Apr 23, 2024
99b5b4d
update outdated diagrams
creme332 Apr 23, 2024
3cc9260
specify charset in dsn
creme332 Apr 24, 2024
9d83a01
set default charset of comment to utf8mb4 to fix error when comment c…
creme332 Apr 24, 2024
e7d3583
rewrite part of FDs for client
creme332 Apr 24, 2024
bcfb567
Merge branch 'main' into new-db-schema
creme332 Apr 24, 2024
8fcb843
use empty() to simplify line 220
creme332 Apr 24, 2024
14e7109
do not show success message if email does not exist
creme332 Apr 24, 2024
1b9a4df
print mysql version
creme332 Apr 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:

- name: Setup database
run: |
mysql -V
sudo /etc/init.d/mysql start
mysql -e "CREATE DATABASE IF NOT EXISTS $TEST_DB_NAME;" -u$DB_USER -p$DB_PASSWORD
mysql -D$TEST_DB_NAME -u$DB_USER -p$DB_PASSWORD -hlocalhost -P3306 < "resources/database/dump/cafe.sql"
Expand Down
15 changes: 8 additions & 7 deletions docs/SOFTWARE_SPECS.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ Clients should be able to:
- Log in to their account.
- Log out of their account.
- View their profile and their personal details.
- Edit their personal details on their profile page.
- Permanently delete their account.
- View their order history.
- Cancel a pending order.
- Reorder a previous order.
- Edit their personal details from their profile page.
- Permanently delete their account from their profile page.
- View their order history on their profile page.
- Cancel a pending order from their profile page.
- Reorder a previous order from their profile page.
- Confirm their purchase and checkout.
- Write a review for any product.
- Comment under any product review.
- Review any product. A review has a rating (1-5) and a description.
- Comment on any product review. Unlike a review, a comment does not include a rating.
- Receive an email notification after placing an order.

### Administrator
Expand All @@ -137,6 +137,7 @@ Administrators should be able to:
- Search for orders by customer name.
- Update the status of orders (e.g., confirmed, in-progress, delivered).
- Send emails to clients about special promotions, discounts, or important updates.
- Comment on a review. Unlike a review, a comment does not include a rating.
- Respond to client reviews.
- Delete client reviews.
- Print a report with sales trends and other key performance indicators.
Expand Down
22 changes: 14 additions & 8 deletions public/js/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,20 @@ function ModalManager(modalID) {
});

// Add event listeners to modal components
document
.querySelector(`#${modalID} article > a[data-target="${modalID}"]`)
.addEventListener("click", (e) => toggleModal(e)); // close button in top right corner
document
.querySelector(`#${modalID} article > footer a[data-target="${modalID}"]`)
.addEventListener("click", (e) => toggleModal(e)); // close button in footer

// console.log("Event listeners added for modal");

const topCloseButton = document.querySelector(
`#${modalID} article > a[data-target="${modalID}"]`,
); // close button in top right corner

if (topCloseButton !== null)
topCloseButton.addEventListener("click", (e) => toggleModal(e));

const bottomCloseButtom = document.querySelector(
`#${modalID} article > footer a[data-target="${modalID}"]`,
); // close button in footer

if (bottomCloseButtom !== null)
bottomCloseButtom.addEventListener("click", (e) => toggleModal(e));
};

return { openModal, closeModal, init };
Expand Down
13 changes: 9 additions & 4 deletions public/js/add-to-cart.js → public/js/product-page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/**
* Script handling modals on product page (/shop/products).
*/
import { Cart, CartItem } from "./cart";
import ModalManager from "./modal";

const modal = ModalManager("my-modal");
const successAddToCartModal = ModalManager("my-modal");
const commentFormModal = ModalManager("comment-box");

function handleAddToCart(e) {
// capture form submission
Expand All @@ -20,13 +24,14 @@ function handleAddToCart(e) {
Cart().addItem(item);

// open modal to display success
modal.openModal();
successAddToCartModal.openModal();
}

window.addEventListener("DOMContentLoaded", function () {
successAddToCartModal.init();
commentFormModal.init();

document
.getElementById("product-customization-form")
.addEventListener("submit", handleAddToCart);
});

modal.init();
4 changes: 2 additions & 2 deletions public/styles/views/Product.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ article > button {
width: min-content;
}

ul > ul {
padding-left: 55px; /* nesting indentation */
li > ul {
padding-left: 5%; /* nesting indentation */
}
192 changes: 113 additions & 79 deletions resources/database/dump/cafe.sql
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,39 @@ LOCK TABLES `client` WRITE;
/*!40000 ALTER TABLE `client` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `comment`
--

DROP TABLE IF EXISTS `comment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `comment` (
`comment_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`text` varchar(2000) NOT NULL,
`created_date` datetime NOT NULL DEFAULT current_timestamp(),
`parent_comment_id` int(10) unsigned DEFAULT NULL,
`user_id` int(10) unsigned NOT NULL,
`review_id` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`comment_id`),
KEY `comment_comment_comment_id_fk` (`parent_comment_id`),
KEY `comment_user_user_id_fk` (`user_id`),
KEY `comment_review_review_id_fk` (`review_id`),
CONSTRAINT `comment_comment_comment_id_fk` FOREIGN KEY (`parent_comment_id`) REFERENCES `comment` (`comment_id`),
CONSTRAINT `comment_review_review_id_fk` FOREIGN KEY (`review_id`) REFERENCES `review` (`review_id`),
CONSTRAINT `comment_user_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `comment`
--

LOCK TABLES `comment` WRITE;
/*!40000 ALTER TABLE `comment` DISABLE KEYS */;
/*!40000 ALTER TABLE `comment` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `district`
--
Expand Down Expand Up @@ -106,23 +139,18 @@ DROP TABLE IF EXISTS `order`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `order` (
`order_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`status` varchar(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`status` varchar(20) DEFAULT 'pending',
`created_date` datetime DEFAULT current_timestamp(),
`pickup_date` datetime DEFAULT NULL,
`street` varchar(255) NOT NULL,
`city` varchar(255) NOT NULL,
`district_id` int(11) unsigned DEFAULT NULL,
`total_price` decimal(10,2) NOT NULL CHECK (`total_price` >= 0),
`user_id` int(11) unsigned DEFAULT NULL,
`client_id` int(11) unsigned DEFAULT NULL,
`store_id` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`order_id`),
KEY `order_fk` (`user_id`),
KEY `order_district_district_id_fk` (`district_id`),
CONSTRAINT `order_district_district_id_fk` FOREIGN KEY (`district_id`) REFERENCES `district` (`district_id`) ON UPDATE CASCADE,
CONSTRAINT `order_fk` FOREIGN KEY (`user_id`) REFERENCES `client` (`user_id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `pickup_date_range` CHECK (`pickup_date` is null or `pickup_date` >= `created_date`),
CONSTRAINT `city_length` CHECK (char_length(`city`) > 2),
CONSTRAINT `street_length` CHECK (char_length(`street`) > 3)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
KEY `order_fk` (`client_id`),
KEY `order_store_store_id_fk` (`store_id`),
CONSTRAINT `order_fk` FOREIGN KEY (`client_id`) REFERENCES `client` (`user_id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `order_store_store_id_fk` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`),
CONSTRAINT `pickup_date_range` CHECK (`pickup_date` is null or `pickup_date` >= `created_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand All @@ -147,6 +175,7 @@ CREATE TABLE `order_product` (
`cup_size` varchar(20) DEFAULT NULL,
`milk_type` varchar(20) DEFAULT NULL,
`quantity` int(11) unsigned DEFAULT NULL,
`unit_price` decimal(10,2) DEFAULT NULL,
PRIMARY KEY (`order_id`,`product_id`),
KEY `order_product_2fk` (`product_id`),
CONSTRAINT `order_product_1fk` FOREIGN KEY (`order_id`) REFERENCES `order` (`order_id`) ON DELETE CASCADE ON UPDATE CASCADE,
Expand All @@ -165,57 +194,6 @@ LOCK TABLES `order_product` WRITE;
/*!40000 ALTER TABLE `order_product` DISABLE KEYS */;
/*!40000 ALTER TABLE `order_product` ENABLE KEYS */;
UNLOCK TABLES;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `UpdateStockLevel` AFTER INSERT ON `order_product` FOR EACH ROW
BEGIN
DECLARE quantity_ordered INT;
DECLARE product_id INT;
SET quantity_ordered = NEW.quantity;
SET product_id = NEW.product_id;
UPDATE `product` SET stock_level = stock_level - quantity_ordered WHERE product_id = product_id;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;

--
-- Table structure for table `password_change_request`
Expand Down Expand Up @@ -256,12 +234,12 @@ CREATE TABLE `product` (
`product_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`calories` int(11) unsigned DEFAULT NULL CHECK (`calories` >= 0),
`stock_level` int(11) unsigned DEFAULT NULL CHECK (`stock_level` >= 0),
`img_url` varchar(255) NOT NULL,
`img_alt_text` varchar(150) NOT NULL,
`category` varchar(50) NOT NULL,
`price` decimal(10,2) NOT NULL,
`description` text DEFAULT NULL CHECK (char_length(`description`) > 0),
`created_date` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`product_id`),
CONSTRAINT `name_length` CHECK (char_length(`name`) > 2),
CONSTRAINT `img_alt_text_length` CHECK (char_length(`img_alt_text`) between 5 and 150),
Expand All @@ -276,7 +254,7 @@ CREATE TABLE `product` (

LOCK TABLES `product` WRITE;
/*!40000 ALTER TABLE `product` DISABLE KEYS */;
INSERT INTO `product` VALUES (1,'Espresso',5,100,'espresso.webp','Espresso in a white cup. Source: Dolce Gusto','Espresso',2.99,'A strong and concentrated coffee drink.'),(2,'Cappuccino',120,75,'cappuccino.webp','Close-up of a steaming cup of freshly brewed Espresso with frothy milk on top. Source: Discount Coffee','Cappuccino',4.99,'An Italian coffee drink made with espresso, hot milk, and steamed milk foam.'),(3,'Latte',150,60,'latte.avif','A latte with a spoon. Source: Peet\'s Coffee.','Latte',3.99,'A coffee drink made with espresso and steamed milk.'),(4,'Americano',5,80,'americano.webp','Close-up of a clear glass mug filled with hot, black Americano coffee, topped with a thin layer of creme. Source: Peet\'s Coffee.','Americano',3.49,'A coffee drink prepared by diluting espresso with hot water.'),(5,'Mocha',200,70,'mocha.png','Rich and indulgent mocha served in a ceramic mug, topped with whipped cream and a dusting of cocoa powder. Source: Starbucks','Mocha',4.49,'A chocolate-flavored variant of a latte, often with whipped cream on top.');
INSERT INTO `product` VALUES (1,'Espresso',5,'espresso.webp','Espresso in a white cup. Source: Dolce Gusto','Espresso',2.99,'A strong and concentrated coffee drink.','2024-04-21 12:37:10'),(2,'Cappuccino',120,'cappuccino.webp','Close-up of a steaming cup of freshly brewed Espresso with frothy milk on top. Source: Discount Coffee','Cappuccino',4.99,'An Italian coffee drink made with espresso, hot milk, and steamed milk foam.','2024-04-21 12:37:10'),(3,'Latte',150,'latte.avif','A latte with a spoon. Source: Peet\'s Coffee.','Latte',3.99,'A coffee drink made with espresso and steamed milk.','2024-04-21 12:37:10'),(4,'Americano',5,'americano.webp','Close-up of a clear glass mug filled with hot, black Americano coffee, topped with a thin layer of creme. Source: Peet\'s Coffee.','Americano',3.49,'A coffee drink prepared by diluting espresso with hot water.','2024-04-21 12:37:10'),(5,'Mocha',200,'mocha.png','Rich and indulgent mocha served in a ceramic mug, topped with whipped cream and a dusting of cocoa powder. Source: Starbucks','Mocha',4.49,'A chocolate-flavored variant of a latte, often with whipped cream on top.','2024-04-21 12:37:10');
/*!40000 ALTER TABLE `product` ENABLE KEYS */;
UNLOCK TABLES;

Expand All @@ -290,21 +268,18 @@ DROP TABLE IF EXISTS `review`;
CREATE TABLE `review` (
`review_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`rating` int(11) unsigned NOT NULL,
`date` date NOT NULL,
`text` text NOT NULL,
`user_id` int(11) unsigned DEFAULT NULL,
`created_date` datetime NOT NULL DEFAULT current_timestamp(),
`text` varchar(2000) NOT NULL,
`client_id` int(11) unsigned DEFAULT NULL,
`product_id` int(11) unsigned DEFAULT NULL,
`parent_review_id` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`review_id`),
KEY `review_1fk` (`user_id`),
KEY `review_1fk` (`client_id`),
KEY `review_2fk` (`product_id`),
KEY `review_3fk` (`parent_review_id`),
CONSTRAINT `review_1fk` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `review_1fk` FOREIGN KEY (`client_id`) REFERENCES `client` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `review_2fk` FOREIGN KEY (`product_id`) REFERENCES `product` (`product_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `review_3fk` FOREIGN KEY (`parent_review_id`) REFERENCES `review` (`review_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `check_rating` CHECK (`rating` between 1 and 5),
CONSTRAINT `text_length` CHECK (char_length(`text`) >= 2)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand All @@ -316,6 +291,65 @@ LOCK TABLES `review` WRITE;
/*!40000 ALTER TABLE `review` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `store`
--

DROP TABLE IF EXISTS `store`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `store` (
`store_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`phone_no` varchar(255) NOT NULL,
`street` varchar(255) NOT NULL,
`coordinate` point NOT NULL,
`district_id` int(10) unsigned NOT NULL,
`city` varchar(255) NOT NULL,
PRIMARY KEY (`store_id`),
KEY `store_district_district_id_fk` (`district_id`),
SPATIAL KEY `store_coordinate_index` (`coordinate`),
CONSTRAINT `store_district_district_id_fk` FOREIGN KEY (`district_id`) REFERENCES `district` (`district_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `store`
--

LOCK TABLES `store` WRITE;
/*!40000 ALTER TABLE `store` DISABLE KEYS */;
INSERT INTO `store` VALUES (1,'+230 630 1329','Royal Road','\0\0\0\0\0\0\0��&†74�J{�/L�L@',1,'Bagatelle'),(2,'+230 630 1234','Angus Road','\0\0\0\0\0\0\0��&†74����&�U@',4,'Albion');
/*!40000 ALTER TABLE `store` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `store_product`
--

DROP TABLE IF EXISTS `store_product`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `store_product` (
`store_id` int(11) unsigned NOT NULL,
`product_id` int(11) unsigned NOT NULL,
`stock_level` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`store_id`,`product_id`),
KEY `store_product_product_product_id_fk` (`product_id`),
CONSTRAINT `store_product_product_product_id_fk` FOREIGN KEY (`product_id`) REFERENCES `product` (`product_id`),
CONSTRAINT `store_product_store_store_id_fk` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `store_product`
--

LOCK TABLES `store_product` WRITE;
/*!40000 ALTER TABLE `store_product` DISABLE KEYS */;
INSERT INTO `store_product` VALUES (1,1,5),(1,2,100),(1,3,56),(1,4,4),(1,5,2),(2,1,22),(2,3,13),(2,4,12);
/*!40000 ALTER TABLE `store_product` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `user`
--
Expand All @@ -337,7 +371,7 @@ CREATE TABLE `user` (
CONSTRAINT `phone_number_length` CHECK (char_length(`phone_no`) > 6),
CONSTRAINT `first_name_length` CHECK (char_length(`first_name`) > 2),
CONSTRAINT `last_name_length` CHECK (char_length(`first_name`) > 2)
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand All @@ -358,4 +392,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2024-04-20 18:34:37
-- Dump completed on 2024-04-24 8:19:02
Binary file modified resources/diagrams/db-schema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading