mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-10 01:52:22 +03:00
Adjusted sql assets.
This commit is contained in:
parent
ae462c1efb
commit
ae8d7e2914
2 changed files with 96 additions and 126 deletions
|
@ -7,168 +7,135 @@ SET time_zone = "+00:00";
|
|||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
|
||||
CREATE TABLE `ea_appointments` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
CREATE TABLE `ea_appoINTments` (
|
||||
`id` INT(11) AUTO_INCREMENT 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
|
||||
`notes` TEXT,
|
||||
`hash` TEXT,
|
||||
`is_unavailable` TINYINT(4) DEFAULT '0',
|
||||
`id_users_provider` INT(11) DEFAULT NULL,
|
||||
`id_users_customer` INT(11) DEFAULT NULL,
|
||||
`id_services` INT(11) 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;
|
||||
|
||||
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,
|
||||
`appointments` int(4) DEFAULT NULL,
|
||||
`customers` int(4) DEFAULT NULL,
|
||||
`services` int(4) DEFAULT NULL,
|
||||
`users` int(4) DEFAULT NULL,
|
||||
`system_settings` int(4) DEFAULT NULL,
|
||||
`user_settings` int(4) DEFAULT NULL
|
||||
`id` INT(11) AUTO_INCREMENT NOT NULL,
|
||||
`name` VARCHAR(256) DEFAULT NULL,
|
||||
`slug` VARCHAR(256) DEFAULT NULL,
|
||||
`is_admin` TINYINT(4) DEFAULT NULL,
|
||||
`appoINTments` INT(11) DEFAULT NULL,
|
||||
`customers` INT(11) DEFAULT NULL,
|
||||
`services` INT(11) DEFAULT NULL,
|
||||
`users` INT(11) DEFAULT NULL,
|
||||
`system_settings` INT(11) DEFAULT NULL,
|
||||
`user_settings` INT(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
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;
|
||||
`id_users_secretary` INT(11) NOT NULL,
|
||||
`id_users_provider` INT(11) 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=utf8;
|
||||
|
||||
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,
|
||||
`availabilities_type` varchar(32) DEFAULT 'flexible',
|
||||
`attendants_number` int(11) DEFAULT '1',
|
||||
`id_service_categories` bigint(20) UNSIGNED DEFAULT NULL
|
||||
`id` INT(11) AUTO_INCREMENT 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,
|
||||
`availabilities_type` VARCHAR(32) DEFAULT 'flexible',
|
||||
`attendants_number` INT(11) DEFAULT '1',
|
||||
`id_service_categories` INT(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_service_categories` (`id_service_categories`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `ea_services_providers` (
|
||||
`id_users` bigint(20) UNSIGNED NOT NULL,
|
||||
`id_services` bigint(20) UNSIGNED NOT NULL
|
||||
`id_users` INT(11) NOT NULL,
|
||||
`id_services` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`id_users`,`id_services`),
|
||||
KEY `id_services` (`id_services`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `ea_service_categories` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
`name` varchar(256) DEFAULT NULL,
|
||||
`description` text
|
||||
`id` INT(11) AUTO_INCREMENT NOT NULL,
|
||||
`name` VARCHAR(256) DEFAULT NULL,
|
||||
`description` TEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `ea_settings` (
|
||||
`id` bigint(20) UNSIGNED NOT NULL,
|
||||
`name` varchar(512) DEFAULT NULL,
|
||||
`value` longtext
|
||||
`id` INT(11) AUTO_INCREMENT NOT NULL,
|
||||
`name` VARCHAR(512) DEFAULT NULL,
|
||||
`value` TEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
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,
|
||||
`mobile_number` varchar(128) DEFAULT NULL,
|
||||
`phone_number` varchar(128) DEFAULT NULL,
|
||||
`address` varchar(256) DEFAULT NULL,
|
||||
`city` varchar(256) DEFAULT NULL,
|
||||
`state` varchar(128) DEFAULT NULL,
|
||||
`zip_code` varchar(64) DEFAULT NULL,
|
||||
`notes` text,
|
||||
`id_roles` bigint(20) UNSIGNED NOT NULL
|
||||
`id` INT(11) AUTO_INCREMENT NOT NULL,
|
||||
`first_name` VARCHAR(256) DEFAULT NULL,
|
||||
`last_name` VARCHAR(512) DEFAULT NULL,
|
||||
`email` VARCHAR(512) DEFAULT NULL,
|
||||
`mobile_number` VARCHAR(128) DEFAULT NULL,
|
||||
`phone_number` VARCHAR(128) DEFAULT NULL,
|
||||
`address` VARCHAR(256) DEFAULT NULL,
|
||||
`city` VARCHAR(256) DEFAULT NULL,
|
||||
`state` VARCHAR(128) DEFAULT NULL,
|
||||
`zip_code` VARCHAR(64) DEFAULT NULL,
|
||||
`notes` TEXT,
|
||||
`id_roles` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_roles` (`id_roles`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
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,
|
||||
`working_plan` text,
|
||||
`notifications` tinyint(4) DEFAULT '0',
|
||||
`google_sync` tinyint(4) DEFAULT '0',
|
||||
`google_token` text,
|
||||
`google_calendar` varchar(128) DEFAULT NULL,
|
||||
`sync_past_days` int(11) DEFAULT '5',
|
||||
`sync_future_days` int(11) DEFAULT '5',
|
||||
`calendar_view` varchar(32) DEFAULT 'default'
|
||||
`id_users` INT(11) NOT NULL,
|
||||
`username` VARCHAR(256) DEFAULT NULL,
|
||||
`password` VARCHAR(512) DEFAULT NULL,
|
||||
`salt` VARCHAR(512) DEFAULT NULL,
|
||||
`working_plan` TEXT,
|
||||
`notifications` TINYINT(4) DEFAULT '0',
|
||||
`google_sync` TINYINT(4) DEFAULT '0',
|
||||
`google_token` TEXT,
|
||||
`google_calendar` VARCHAR(128) DEFAULT NULL,
|
||||
`sync_past_days` INT(11) DEFAULT '5',
|
||||
`sync_future_days` INT(11) DEFAULT '5',
|
||||
`calendar_view` VARCHAR(32) DEFAULT 'default',
|
||||
PRIMARY KEY (`id_users`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
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_appoINTments`
|
||||
ADD CONSTRAINT `ea_appoINTments_ea_users_customer` FOREIGN KEY (`id_users_customer`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `ea_appoINTments_ea_services` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `ea_appoINTments_ea_users_provider` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
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`);
|
||||
ADD CONSTRAINT `ea_secretaries_ea_users_secretary` FOREIGN KEY (`id_users_secretary`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `ea_secretaries_ea_users_provider` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `ea_services`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `id_service_categories` (`id_service_categories`);
|
||||
ADD CONSTRAINT `ea_services_ea_service_categories` FOREIGN KEY (`id_service_categories`) REFERENCES `ea_service_categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
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`);
|
||||
ADD CONSTRAINT `ea_services_providers_ea_users_provider` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `ea_services_providers_ea_services` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `ea_users`
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD KEY `id_roles` (`id_roles`);
|
||||
ADD CONSTRAINT `ea_users_ea_roles` FOREIGN KEY (`id_roles`) REFERENCES `ea_roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `ea_user_settings`
|
||||
ADD PRIMARY KEY (`id_users`);
|
||||
|
||||
|
||||
ALTER TABLE `ea_appointments`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `ea_roles`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `ea_services`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `ea_service_categories`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `ea_settings`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `ea_users`
|
||||
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
ALTER TABLE `ea_users`
|
||||
ADD CONSTRAINT `ea_users_ibfk_1` FOREIGN KEY (`id_roles`) REFERENCES `ea_roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
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;
|
||||
ADD CONSTRAINT `ea_user_settings_ea_users` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
INSERT INTO `ea_roles` (`id`, `name`, `slug`, `is_admin`, `appointments`, `customers`, `services`, `users`, `system_settings`, `user_settings`)
|
||||
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),
|
||||
(2, 'Provider', 'provider', 0, 15, 15, 0, 0, 0, 15),
|
||||
(3, 'Customer', 'customer', 0, 0, 0, 0, 0, 0, 0),
|
||||
(4, 'Secretary', 'secretary', 0, 15, 15, 0, 0, 0, 15);
|
||||
|
||||
INSERT INTO `ea_settings` (`name`, `value`) VALUES
|
||||
INSERT INTO
|
||||
`ea_settings` (`name`, `value`)
|
||||
VALUES
|
||||
('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"}]}}'),
|
||||
('book_advance_timeout', '30'),
|
||||
|
|
Loading…
Reference in a new issue