diff --git a/rsc/db/sample-data.sql b/rsc/db/sample-data.sql index 7758b8b6..8a17ed20 100644 --- a/rsc/db/sample-data.sql +++ b/rsc/db/sample-data.sql @@ -1,35 +1,11 @@ - SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; - /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; --- --- Database: `easyappointments` --- - --- --- Dumping data for table `ea_settings` --- - -INSERT INTO `ea_settings` (`id`, `name`, `value`) VALUES -(1, 'company_working_plan', '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"saturday":null,"sunday":null}'), -(2, 'book_advance_timeout', '30'), -(3, 'company_name', 'ABC Company'), -(4, 'company_email', 'info@abc-company.ea'), -(5, 'company_link', 'http://www.abc-company.ea'), -(6, 'google_analytics_code', ''), -(7, 'customer_notifications', '1'), -(8, 'date_format', 'DMY'), -(9, 'require_captcha', '1'); - --- --- Dumping data for table `ea_roles` --- INSERT INTO `ea_roles` (`id`, `name`, `slug`, `is_admin`, `appointments`, `customers`, `services`, `users`, `system_settings`, `user_settings`) VALUES (1, 'Administrator', 'admin', 1, 15, 15, 15, 15, 15, 15), @@ -37,63 +13,39 @@ INSERT INTO `ea_roles` (`id`, `name`, `slug`, `is_admin`, `appointments`, `custo (3, 'Customer', 'customer', 0, 0, 0, 0, 0, 0, 0), (4, 'Secretary', 'secretary', 0, 15, 15, 0, 0, 0, 15); --- --- Dumping data for table `ea_users` --- - -INSERT INTO `ea_users` (`id`, `first_name`, `last_name`, `email`, `mobile_number`, `phone_number`, `address`, `city`, `state`, `zip_code`, `notes`, `id_roles`) VALUES -(1, 'John', 'Smith', 'info@abc-company.ea', '0123 4567890', '0123 4567891', 'Tst-Address 12', 'Tst-City', 'Tst-State', '012345', 'Test administrator record for this installation. ', 1), -(2, 'George ', 'Clayton', 'g.clayton@abc-company.ea', '0123 456 7890', '0123 456 7891', 'Tst-Address 12', 'Tst-City', 'Tst-State', '012345', 'This is one of the test providers. He will handle the quick services.', 2), -(3, 'Christina', 'Nickolson', 'c.nickolson@abc-company.ea', '0123 4567890', '0123 4567891', 'Tst-Address 12', 'Tst-City', 'Tst-State', '012345', 'This provider will handle the long services.', 2), -(4, 'Nicky', 'Rowland', 'n.rowland@abc-company.ea', '0123 4567890', '0123 4567891', 'Tst-Address 12', 'Tst-City', 'Tst-State', '012345', 'This is the only secretary of the app. She will handle the data of Christina.', 4), -(5, 'John', 'Doe', 'john.doe@abc-company.ea', NULL, '0123 4567890', 'Tst-Address 12', 'Tst-City', NULL, '012345', 'This is a test customer record.', 3); - --- --- Dumping data for table `ea_user_settings` --- - -INSERT INTO `ea_user_settings` (`id_users`, `username`, `password`, `salt`, `working_plan`, `notifications`, `google_sync`, `google_token`, `google_calendar`, `sync_past_days`, `sync_future_days`) VALUES -(1, 'administrator', 'fa7fc34500cbed7c3546f8b223f10797f24ecc9ccbf0c2251c21ab965ebf19bf', 'e0a9e47fbf57babcf536e98bed783a9404b95b671cdcf9e391f68989fa3ac14f', NULL, 1, 0, NULL, NULL, 5, 5), -(2, 'g.clayton', 'a86f0c41be938c36eaedb3c4869c445fe8b7192188110f57bf86b55ac2252f05', '9b56eaa06cb0cc1c3bdce616291da4f53c2cc5d3449591bacb28099346333f05', '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"saturday":null,"sunday":null}', 1, 0, NULL, NULL, 5, 5), -(3, 'c.nickolson', '7dcd5ed6a1cc42de678227aa8d528069761b218d181ff7ef446a49622c384782', '807349d6bacc35650205c66d664d4d414d150dec7f17dbba360752224bab73f4', '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"saturday":null,"sunday":null}', 1, 0, NULL, NULL, 5, 5), -(4, 'n.rowland', '8cd1cc276a72f88e6d27372aecde8d87903a91fa33a6d2aceafbf2d110e4c9c2', '55b3a83cea1e3a5c4945fcb12a7621519705b3d09c4fa3408d912a832c8410a1', NULL, 1, 0, NULL, NULL, 5, 5); - --- --- Dumping data for table `ea_secretaries_providers` --- - INSERT INTO `ea_secretaries_providers` (`id_users_secretary`, `id_users_provider`) VALUES -(4, 3); +(87, 85); - --- --- Dumping data for table `ea_service_categories` --- - -INSERT INTO `ea_service_categories` (`id`, `name`, `description`) VALUES -(1, 'Quick Services', 'A collection of services that have small duration. '), -(2, 'Long Services', 'A collection of services that require more time. '); - --- --- Dumping data for table `ea_services` --- - -INSERT INTO `ea_services` (`id`, `name`, `duration`, `price`, `currency`, `description`, `id_service_categories`) VALUES -(1, 'Best Quick Service ', 30, 50.00, '€', 'This is the best service and it requires only 30 minutes of your time!', 1), -(2, 'Another Q. Service', 45, 60.00, '€', 'This will be the best choice for someone that wants a balance between time and money.', 1), -(3, 'Best Long Service', 180, 100.00, '€', 'This long service will examine all the aspects of your problem. Definitely the best solution!', 2), -(4, 'Ungrouped Srv.', 45, 0.00, '', 'This category is not like the rest. It can''t be grouped. ', NULL); - --- --- Dumping data for table `ea_services_providers` --- +INSERT INTO `ea_services` (`id`, `name`, `duration`, `price`, `currency`, `description`, `availabilities_type`, `attendants_number`, `id_service_categories`) VALUES +(13, 'Test Service', 30, '50.00', 'Euro', 'This is a test service automatically inserted by the installer.', 'flexible', 1, NULL); INSERT INTO `ea_services_providers` (`id_users`, `id_services`) VALUES -(2, 1), -(2, 2), -(3, 3), -(2, 4), -(3, 4); +(85, 13); + +INSERT INTO `ea_service_categories` (`id`, `name`, `description`) VALUES +(24, 'Test Category', 'This is a test service category.'); + +INSERT INTO `ea_settings` (`id`, `name`, `value`) VALUES +(16, 'company_working_plan', '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"saturday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"sunday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]}}'), +(17, 'book_advance_timeout', '30'), +(18, 'google_analytics_code', ''), +(19, 'customer_notifications', '1'), +(20, 'date_format', 'DMY'), +(21, 'require_captcha', '0'), +(22, 'company_name', 'JD & Co'), +(23, 'company_email', 'john@doe12345.com'), +(24, 'company_link', 'http://doe12345.com'); + +INSERT INTO `ea_users` (`id`, `first_name`, `last_name`, `email`, `mobile_number`, `phone_number`, `address`, `city`, `state`, `zip_code`, `notes`, `id_roles`) VALUES +(84, 'John', 'Doe', 'john@doe12345.com', '123123123', '123123123', 'Some Str 123', 'Some City', 'Some State', '12345', 'This is a test administrator.', 1), +(85, 'Jane', 'Doe', 'jane@doe12345.com', '0123456789', '0123456789', 'Some Str 123', 'Some City', 'Some State', '12345', 'This is a test provider', 2), +(86, 'Chris', 'Doe', 'chris@doe12345.com', NULL, '123123123', 'Some Str 123', 'Some City', NULL, '12345', 'This is a test customer.', 3), +(87, 'Chloe', 'Doe', 'chloe@doe12345.com', '123123123', '123123123', 'Some Str 123', 'Some City', 'Some State', '12345', 'This is a test secretary.', 4); + +INSERT INTO `ea_user_settings` (`id_users`, `username`, `password`, `salt`, `working_plan`, `notifications`, `google_sync`, `google_token`, `google_calendar`, `sync_past_days`, `sync_future_days`, `calendar_view`) VALUES +(84, 'administrator', 'c1871d3852f8b78503c5e4f585f3979d0580b4d0339533ae5b55abbe3dba7a4b', '703006e3a7c61db01c943eda81b50ac4ca567e1e61fd677b6a8b431c8bd95eeb', NULL, 0, 0, NULL, NULL, 5, 5, 'default'), +(85, 'jane@doe12345.com', '29cc4447507f0ea740a5d666944e997059b02cc0a968fa3f29eb5574cc1df2e7', 'f7b509c4b37f734ed1c3c65466b62843979bf4a354c3c3a1ab4752f9399df95c', '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"14:30","end":"15:00"}]},"saturday":null,"sunday":null}', 0, 0, NULL, NULL, 5, 5, 'default'), +(87, 'chloe@doe12345.com', '2ad09a6c7b100048a48c380290206c35d953ed224c706d6f61d2198a9413c115', '8701d60910fb5994d4700f8057cebb16e94326d397241c7baac7c9b9c61012e6', NULL, 0, 0, NULL, NULL, 5, 5, 'default'); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; diff --git a/rsc/db/structure.sql b/rsc/db/structure.sql index 5db77ad7..ea28cf1e 100644 --- a/rsc/db/structure.sql +++ b/rsc/db/structure.sql @@ -1,140 +1,75 @@ - SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; - /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; --- --- Database: `easyappointments` --- --- -------------------------------------------------------- - --- --- Table structure for table `ea_appointments` --- - -CREATE TABLE IF NOT EXISTS `ea_appointments` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, +CREATE TABLE `ea_appointments` ( + `id` bigint(20) UNSIGNED NOT NULL, `book_datetime` datetime DEFAULT NULL, `start_datetime` datetime DEFAULT NULL, `end_datetime` datetime DEFAULT NULL, `notes` text, `hash` text, `is_unavailable` tinyint(4) DEFAULT '0', - `id_users_provider` bigint(20) unsigned DEFAULT NULL, - `id_users_customer` bigint(20) unsigned DEFAULT NULL, - `id_services` bigint(20) unsigned DEFAULT NULL, - `id_google_calendar` text, - PRIMARY KEY (`id`), - KEY `id_users_customer` (`id_users_customer`), - KEY `id_services` (`id_services`), - KEY `id_users_provider` (`id_users_provider`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + `id_users_provider` bigint(20) UNSIGNED DEFAULT NULL, + `id_users_customer` bigint(20) UNSIGNED DEFAULT NULL, + `id_services` bigint(20) UNSIGNED DEFAULT NULL, + `id_google_calendar` text +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `ea_roles` --- - -CREATE TABLE IF NOT EXISTS `ea_roles` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, +CREATE TABLE `ea_roles` ( + `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(256) DEFAULT NULL, `slug` varchar(256) DEFAULT NULL, - `is_admin` tinyint(4) DEFAULT NULL COMMENT '0', - `appointments` int(4) DEFAULT NULL COMMENT '0', - `customers` int(4) DEFAULT NULL COMMENT '0', - `services` int(4) DEFAULT NULL COMMENT '0', - `users` int(4) DEFAULT NULL COMMENT '0', - `system_settings` int(4) DEFAULT NULL COMMENT '0', - `user_settings` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; + `is_admin` tinyint(4) DEFAULT NULL COMMENT, + `appointments` int(4) DEFAULT NULL COMMENT, + `customers` int(4) DEFAULT NULL COMMENT, + `services` int(4) DEFAULT NULL COMMENT, + `users` int(4) DEFAULT NULL COMMENT, + `system_settings` int(4) DEFAULT NULL COMMENT, + `user_settings` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `ea_secretaries_providers` --- - -CREATE TABLE IF NOT EXISTS `ea_secretaries_providers` ( - `id_users_secretary` bigint(20) unsigned NOT NULL, - `id_users_provider` bigint(20) unsigned NOT NULL, - PRIMARY KEY (`id_users_secretary`,`id_users_provider`), - KEY `fk_ea_secretaries_providers_1` (`id_users_secretary`), - KEY `fk_ea_secretaries_providers_2` (`id_users_provider`) +CREATE TABLE `ea_secretaries_providers` ( + `id_users_secretary` bigint(20) UNSIGNED NOT NULL, + `id_users_provider` bigint(20) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; --- -------------------------------------------------------- - --- --- Table structure for table `ea_services` --- - -CREATE TABLE IF NOT EXISTS `ea_services` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, +CREATE TABLE `ea_services` ( + `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(256) DEFAULT NULL, `duration` int(11) DEFAULT NULL, `price` decimal(10,2) DEFAULT NULL, `currency` varchar(32) DEFAULT NULL, `description` text, - `id_service_categories` bigint(20) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `id_service_categories` (`id_service_categories`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - --- -------------------------------------------------------- - --- --- Table structure for table `ea_services_providers` --- - -CREATE TABLE IF NOT EXISTS `ea_services_providers` ( - `id_users` bigint(20) unsigned NOT NULL, - `id_services` bigint(20) unsigned NOT NULL, - PRIMARY KEY (`id_users`,`id_services`), - KEY `id_services` (`id_services`) + `availabilities_type` varchar(32) DEFAULT 'flexible', + `attendants_number` int(11) DEFAULT '1', + `id_service_categories` bigint(20) UNSIGNED DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- -------------------------------------------------------- +CREATE TABLE `ea_services_providers` ( + `id_users` bigint(20) UNSIGNED NOT NULL, + `id_services` bigint(20) UNSIGNED NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- --- Table structure for table `ea_service_categories` --- - -CREATE TABLE IF NOT EXISTS `ea_service_categories` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, +CREATE TABLE `ea_service_categories` ( + `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(256) DEFAULT NULL, - `description` text, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + `description` text +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `ea_settings` --- - -CREATE TABLE IF NOT EXISTS `ea_settings` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, +CREATE TABLE `ea_settings` ( + `id` bigint(20) UNSIGNED NOT NULL, `name` varchar(512) DEFAULT NULL, - `value` longtext, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=21 ; + `value` longtext +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `ea_users` --- - -CREATE TABLE IF NOT EXISTS `ea_users` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, +CREATE TABLE `ea_users` ( + `id` bigint(20) UNSIGNED NOT NULL, `first_name` varchar(256) DEFAULT NULL, `last_name` varchar(512) DEFAULT NULL, `email` varchar(512) DEFAULT NULL, @@ -145,19 +80,11 @@ CREATE TABLE IF NOT EXISTS `ea_users` ( `state` varchar(128) DEFAULT NULL, `zip_code` varchar(64) DEFAULT NULL, `notes` text, - `id_roles` bigint(20) unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `id_roles` (`id_roles`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=85 ; + `id_roles` bigint(20) UNSIGNED NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- -------------------------------------------------------- - --- --- Table structure for table `ea_user_settings` --- - -CREATE TABLE IF NOT EXISTS `ea_user_settings` ( - `id_users` bigint(20) unsigned NOT NULL, +CREATE TABLE `ea_user_settings` ( + `id_users` bigint(20) UNSIGNED NOT NULL, `username` varchar(256) DEFAULT NULL, `password` varchar(512) DEFAULT NULL, `salt` varchar(512) DEFAULT NULL, @@ -168,50 +95,78 @@ CREATE TABLE IF NOT EXISTS `ea_user_settings` ( `google_calendar` varchar(128) DEFAULT NULL, `sync_past_days` int(11) DEFAULT '5', `sync_future_days` int(11) DEFAULT '5', - PRIMARY KEY (`id_users`) + `calendar_view` varchar(32) DEFAULT 'default' ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- --- Constraints for dumped tables --- --- --- Constraints for table `ea_appointments` --- +ALTER TABLE `ea_appointments` + ADD PRIMARY KEY (`id`), + ADD KEY `id_users_customer` (`id_users_customer`), + ADD KEY `id_services` (`id_services`), + ADD KEY `id_users_provider` (`id_users_provider`); + +ALTER TABLE `ea_roles` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `ea_secretaries_providers` + ADD PRIMARY KEY (`id_users_secretary`,`id_users_provider`), + ADD KEY `fk_ea_secretaries_providers_1` (`id_users_secretary`), + ADD KEY `fk_ea_secretaries_providers_2` (`id_users_provider`); + +ALTER TABLE `ea_services` + ADD PRIMARY KEY (`id`), + ADD KEY `id_service_categories` (`id_service_categories`); + +ALTER TABLE `ea_services_providers` + ADD PRIMARY KEY (`id_users`,`id_services`), + ADD KEY `id_services` (`id_services`); + +ALTER TABLE `ea_service_categories` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `ea_settings` + ADD PRIMARY KEY (`id`); + +ALTER TABLE `ea_users` + ADD PRIMARY KEY (`id`), + ADD KEY `id_roles` (`id_roles`); + +ALTER TABLE `ea_user_settings` + ADD PRIMARY KEY (`id_users`); + + +ALTER TABLE `ea_appointments` + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=63; +ALTER TABLE `ea_roles` + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; +ALTER TABLE `ea_services` + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14; +ALTER TABLE `ea_service_categories` + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25; +ALTER TABLE `ea_settings` + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25; +ALTER TABLE `ea_users` + MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=88; + ALTER TABLE `ea_appointments` ADD CONSTRAINT `ea_appointments_ibfk_2` FOREIGN KEY (`id_users_customer`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `ea_appointments_ibfk_3` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `ea_appointments_ibfk_4` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; --- --- Constraints for table `ea_secretaries_providers` --- ALTER TABLE `ea_secretaries_providers` ADD CONSTRAINT `fk_ea_secretaries_providers_1` FOREIGN KEY (`id_users_secretary`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_ea_secretaries_providers_2` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; --- --- Constraints for table `ea_services` --- ALTER TABLE `ea_services` ADD CONSTRAINT `ea_services_ibfk_1` FOREIGN KEY (`id_service_categories`) REFERENCES `ea_service_categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; --- --- Constraints for table `ea_services_providers` --- ALTER TABLE `ea_services_providers` ADD CONSTRAINT `ea_services_providers_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `ea_services_providers_ibfk_2` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; --- --- Constraints for table `ea_users` --- ALTER TABLE `ea_users` ADD CONSTRAINT `ea_users_ibfk_1` FOREIGN KEY (`id_roles`) REFERENCES `ea_roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; --- --- Constraints for table `ea_user_settings` --- ALTER TABLE `ea_user_settings` ADD CONSTRAINT `ea_user_settings_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;