From 71eb23e7c5031edeb1fa6ca82d5545caffabbe4e Mon Sep 17 00:00:00 2001 From: "alextselegidis@gmail.com" Date: Thu, 12 Sep 2013 08:20:31 +0000 Subject: [PATCH] * Updated the database structure file. --- db/easy_appointments.sql | 88 +++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 20 deletions(-) diff --git a/db/easy_appointments.sql b/db/easy_appointments.sql index a703614e..e07aa606 100644 --- a/db/easy_appointments.sql +++ b/db/easy_appointments.sql @@ -1,13 +1,13 @@ -- phpMyAdmin SQL Dump --- version 3.5.1 +-- version 4.0.3 -- http://www.phpmyadmin.net -- -- Φιλοξενητής: localhost --- Χρόνος δημιουργίας: 15 Ιουλ 2013 στις 10:07:35 --- Έκδοση διακομιστή: 5.5.24-log --- Έκδοση PHP: 5.4.3 +-- Χρόνος δημιουργίας: 12 Σεπ 2013 στις 11:19:36 +-- Έκδοση διακομιστή: 5.5.32-0ubuntu0.12.04.1 +-- Έκδοση PHP: 5.5.3-1+debphp.org~precise+2 -SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; @@ -19,6 +19,8 @@ SET time_zone = "+00:00"; -- -- Βάση: `easy_appointments` -- +CREATE DATABASE IF NOT EXISTS `easy_appointments` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; +USE `easy_appointments`; -- -------------------------------------------------------- @@ -42,7 +44,14 @@ CREATE TABLE IF NOT EXISTS `ea_appointments` ( 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=102 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; + +-- +-- Άδειασμα δεδομένων του πίνακα `ea_appointments` +-- + +INSERT INTO `ea_appointments` (`id`, `book_datetime`, `start_datetime`, `end_datetime`, `notes`, `hash`, `is_unavailable`, `id_users_provider`, `id_users_customer`, `id_services`, `id_google_calendar`) VALUES +(1, '2013-08-22 23:23:41', '2013-08-23 09:00:00', '2013-08-23 09:20:00', '', '65cac73b2b0ad4f524db6e707c5908e7', 0, 2, 5, 1, NULL); -- -------------------------------------------------------- @@ -61,16 +70,40 @@ CREATE TABLE IF NOT EXISTS `ea_roles` ( `notifications` int(4) DEFAULT NULL COMMENT '0', `appointments` int(4) DEFAULT NULL COMMENT '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; -- -- Άδειασμα δεδομένων του πίνακα `ea_roles` -- INSERT INTO `ea_roles` (`id`, `name`, `slug`, `is_admin`, `services`, `providers`, `customers`, `notifications`, `appointments`) VALUES -(1, 'Administrator', 'administrator', 1, 15, 15, 15, 15, 15), +(1, 'Administrator', 'admin', 1, 15, 15, 15, 15, 15), (2, 'Provider', 'provider', 0, 0, 0, 15, 0, 15), -(3, 'Customer', 'customer', 0, 0, 0, 0, 0, 0); +(3, 'Customer', 'customer', 0, 0, 0, 0, 0, 0), +(4, 'Secretary', 'secretary', 0, 0, 0, 15, 15, 15); + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `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`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Άδειασμα δεδομένων του πίνακα `ea_secretaries_providers` +-- + +INSERT INTO `ea_secretaries_providers` (`id_users_secretary`, `id_users_provider`) VALUES +(20, 2), +(20, 3), +(22, 2); -- -------------------------------------------------------- @@ -88,16 +121,16 @@ CREATE TABLE IF NOT EXISTS `ea_services` ( `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=10 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; -- -- Άδειασμα δεδομένων του πίνακα `ea_services` -- INSERT INTO `ea_services` (`id`, `name`, `duration`, `price`, `currency`, `description`, `id_service_categories`) VALUES -(1, 'General Examination', 20, '50.00', 'euro', 'General examination of the patient.', NULL), -(2, 'Heart Examination', 30, '40.00', 'euro', 'Checkup for heart problems.', NULL), -(3, 'Neurological Examination', 20, '35.00', 'euro', 'Neurological tests for the patient.', NULL); +(1, 'General Examination', 20, 50.00, 'euro', 'General examination of the patient.', NULL), +(2, 'Heart Examination', 30, 40.00, 'euro', 'Checkup for heart problems.', NULL), +(3, 'Neurological Examination', 20, 35.00, 'euro', 'Neurological tests for the patient.', NULL); -- -------------------------------------------------------- @@ -117,7 +150,6 @@ CREATE TABLE IF NOT EXISTS `ea_services_providers` ( -- INSERT INTO `ea_services_providers` (`id_users`, `id_services`) VALUES -(1, 1), (2, 1), (3, 1), (4, 1), @@ -184,18 +216,22 @@ CREATE TABLE IF NOT EXISTS `ea_users` ( `id_roles` bigint(20) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `id_roles` (`id_roles`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=23 ; -- -- Άδειασμα δεδομένων του πίνακα `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, 'Ringo', 'Starr', 'alextselegidis@gmail.com', '0000000000000', '0000000000000', 'Some Str', 'Some City', 'Some State 0', '00000', 'This is me making Easy!Appointments :P', 1), (2, 'George', 'Harrison', 'alextselegidis@gmail.com', '1111111111111', '1111111111111', 'Some Str 1', 'Some City 1', 'Some State 1', '11111', 'This is a test provider (with my email for google syncing).', 2), (3, 'John', 'Lennon', 'prov2@test.gr', '2222222222222', '2222222222222', 'Some Str 2', 'Some City 2', 'Some State 2', '22222', NULL, 2), (4, 'Paul', 'McCartney', 'prov3@test.gr', '3333333333333', '3333333333333', 'Some Str 3', 'Some City 3', 'Some State 3', '33333', NULL, 2), -(5, 'John', 'Doe', 'alextselegidis@yahoo.gr', NULL, '0123456789', '', '', NULL, '', 'This is my testing customer.', 3); +(5, '', 'a', 'alextselegidis@yahoo.gr', NULL, 'a', '', '', NULL, '', 'This is my testing customer.', 3), +(12, 'Admin', 'Admin', 'info@alextselegidis.com', '0', '0', 'Some Str 0', 'Some City 0', 'Some State 0', '00000', 'This is an admin.', 1), +(18, 'test', 'test', 'test@test.com', 'test', 'test', 'test', 'test', 'test', '', '', 1), +(20, 'b', 'b', 'b@b.com', '', 'b', '', '', '', '', '', 4), +(21, 'c', 'c', 'c@c.com', '', 'c', '', '', '', '', '', 4), +(22, '', 't', 't@t.com', '', 't', '', '', '', '', '', 4); -- -------------------------------------------------------- @@ -221,9 +257,14 @@ CREATE TABLE IF NOT EXISTS `ea_user_settings` ( -- INSERT INTO `ea_user_settings` (`id_users`, `username`, `password`, `working_plan`, `notifications`, `google_sync`, `google_token`, `sync_past_days`, `sync_future_days`) VALUES -(2, 'provider_1', 'provider_1', '{"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"}]}}', NULL, 0, NULL, 5, 5), -(3, 'provider_2', 'provider_2', '{"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"}]}}', NULL, 0, NULL, 5, 5), -(4, 'provider_3', 'provider_3', '{"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"}]}}', NULL, 0, NULL, 5, 5); +(2, 'provider_1', 'provider_1', '{"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"}]}}', '0', 0, NULL, 5, 5), +(3, 'provider_2', 'provider_2', '{"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"}]}}', '0', 0, NULL, 5, 5), +(4, 'provider_3', 'provider_3', '{"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"}]}}', '0', 0, NULL, 5, 5), +(12, 'admin', 'admin', '', '1', 0, NULL, 5, 5), +(18, 'test', 'aka', NULL, '0', 0, NULL, 5, 5), +(20, 'b', NULL, NULL, '0', 0, NULL, 5, 5), +(21, 'c', 'c', NULL, '1', 0, NULL, 5, 5), +(22, 't', 't', NULL, '0', 0, NULL, 5, 5); -- -- Περιορισμοί για άχρηστους πίνακες @@ -237,6 +278,13 @@ ALTER TABLE `ea_appointments` 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; +-- +-- Περιορισμοί για πίνακα `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; + -- -- Περιορισμοί για πίνακα `ea_services` --