Refactored structure.sql

This commit is contained in:
alext 2017-06-19 09:46:06 +02:00
parent 358ecbfc9e
commit aff86bd021

View file

@ -2,17 +2,17 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00"; SET time_zone = "+00:00";
CREATE TABLE IF NOT EXISTS `ea_appointments` ( CREATE TABLE IF NOT EXISTS `ea_appointments` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`book_datetime` datetime DEFAULT NULL, `book_datetime` DATETIME DEFAULT NULL,
`start_datetime` datetime DEFAULT NULL, `start_datetime` DATETIME DEFAULT NULL,
`end_datetime` datetime DEFAULT NULL, `end_datetime` DATETIME DEFAULT NULL,
`notes` text, `notes` TEXT,
`hash` text, `hash` TEXT,
`is_unavailable` tinyint(4) DEFAULT '0', `is_unavailable` TINYINT(4) DEFAULT '0',
`id_users_provider` bigint(20) unsigned DEFAULT NULL, `id_users_provider` BIGINT(20) UNSIGNED DEFAULT NULL,
`id_users_customer` bigint(20) unsigned DEFAULT NULL, `id_users_customer` BIGINT(20) UNSIGNED DEFAULT NULL,
`id_services` bigint(20) unsigned DEFAULT NULL, `id_services` BIGINT(20) UNSIGNED DEFAULT NULL,
`id_google_calendar` text, `id_google_calendar` TEXT,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `id_users_customer` (`id_users_customer`), KEY `id_users_customer` (`id_users_customer`),
KEY `id_services` (`id_services`), KEY `id_services` (`id_services`),
@ -21,23 +21,23 @@ CREATE TABLE IF NOT EXISTS `ea_appointments` (
CREATE TABLE IF NOT EXISTS `ea_roles` ( CREATE TABLE IF NOT EXISTS `ea_roles` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(256) DEFAULT NULL, `name` VARCHAR(256) DEFAULT NULL,
`slug` varchar(256) DEFAULT NULL, `slug` VARCHAR(256) DEFAULT NULL,
`is_admin` tinyint(4) DEFAULT NULL COMMENT '0', `is_admin` TINYINT(4) DEFAULT NULL,
`appointments` int(4) DEFAULT NULL COMMENT '0', `appointments` INT(4) DEFAULT NULL,
`customers` int(4) DEFAULT NULL COMMENT '0', `customers` INT(4) DEFAULT NULL,
`services` int(4) DEFAULT NULL COMMENT '0', `services` INT(4) DEFAULT NULL,
`users` int(4) DEFAULT NULL COMMENT '0', `users` INT(4) DEFAULT NULL,
`system_settings` int(4) DEFAULT NULL COMMENT '0', `system_settings` INT(4) DEFAULT NULL,
`user_settings` int(11) DEFAULT NULL, `user_settings` INT(11) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ea_secretaries_providers` ( CREATE TABLE IF NOT EXISTS `ea_secretaries_providers` (
`id_users_secretary` bigint(20) unsigned NOT NULL, `id_users_secretary` BIGINT(20) UNSIGNED NOT NULL,
`id_users_provider` bigint(20) unsigned NOT NULL, `id_users_provider` BIGINT(20) UNSIGNED NOT NULL,
PRIMARY KEY (`id_users_secretary`,`id_users_provider`), PRIMARY KEY (`id_users_secretary`,`id_users_provider`),
KEY `fk_ea_secretaries_providers_1` (`id_users_secretary`), KEY `fk_ea_secretaries_providers_1` (`id_users_secretary`),
KEY `fk_ea_secretaries_providers_2` (`id_users_provider`) KEY `fk_ea_secretaries_providers_2` (`id_users_provider`)
@ -45,75 +45,75 @@ CREATE TABLE IF NOT EXISTS `ea_secretaries_providers` (
CREATE TABLE IF NOT EXISTS `ea_services` ( CREATE TABLE IF NOT EXISTS `ea_services` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(256) DEFAULT NULL, `name` VARCHAR(256) DEFAULT NULL,
`duration` int(11) DEFAULT NULL, `duration` INT(11) DEFAULT NULL,
`price` decimal(10,2) DEFAULT NULL, `price` DECIMAL(10,2) DEFAULT NULL,
`currency` varchar(32) DEFAULT NULL, `currency` VARCHAR(32) DEFAULT NULL,
`description` text, `description` TEXT,
`availabilities_type` varchar(32) DEFAULT 'flexible', `availabilities_type` VARCHAR(32) DEFAULT 'flexible',
`attendants_number` int(11) DEFAULT '1', `attendants_number` INT(11) DEFAULT '1',
`id_service_categories` bigint(20) unsigned DEFAULT NULL, `id_service_categories` BIGINT(20) UNSIGNED DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `id_service_categories` (`id_service_categories`) KEY `id_service_categories` (`id_service_categories`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ea_services_providers` ( CREATE TABLE IF NOT EXISTS `ea_services_providers` (
`id_users` bigint(20) unsigned NOT NULL, `id_users` BIGINT(20) UNSIGNED NOT NULL,
`id_services` bigint(20) unsigned NOT NULL, `id_services` BIGINT(20) UNSIGNED NOT NULL,
PRIMARY KEY (`id_users`,`id_services`), PRIMARY KEY (`id_users`,`id_services`),
KEY `id_services` (`id_services`) KEY `id_services` (`id_services`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ea_service_categories` ( CREATE TABLE IF NOT EXISTS `ea_service_categories` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(256) DEFAULT NULL, `name` VARCHAR(256) DEFAULT NULL,
`description` text, `description` TEXT,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ea_settings` ( CREATE TABLE IF NOT EXISTS `ea_settings` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(512) DEFAULT NULL, `name` VARCHAR(512) DEFAULT NULL,
`value` longtext, `value` LONGTEXT,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ea_users` ( CREATE TABLE IF NOT EXISTS `ea_users` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`first_name` varchar(256) DEFAULT NULL, `first_name` VARCHAR(256) DEFAULT NULL,
`last_name` varchar(512) DEFAULT NULL, `last_name` VARCHAR(512) DEFAULT NULL,
`email` varchar(512) DEFAULT NULL, `email` VARCHAR(512) DEFAULT NULL,
`mobile_number` varchar(128) DEFAULT NULL, `mobile_number` VARCHAR(128) DEFAULT NULL,
`phone_number` varchar(128) DEFAULT NULL, `phone_number` VARCHAR(128) DEFAULT NULL,
`address` varchar(256) DEFAULT NULL, `address` VARCHAR(256) DEFAULT NULL,
`city` varchar(256) DEFAULT NULL, `city` VARCHAR(256) DEFAULT NULL,
`state` varchar(128) DEFAULT NULL, `state` VARCHAR(128) DEFAULT NULL,
`zip_code` varchar(64) DEFAULT NULL, `zip_code` VARCHAR(64) DEFAULT NULL,
`notes` text, `notes` TEXT,
`id_roles` bigint(20) unsigned NOT NULL, `id_roles` BIGINT(20) UNSIGNED NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `id_roles` (`id_roles`) KEY `id_roles` (`id_roles`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `ea_user_settings` ( CREATE TABLE IF NOT EXISTS `ea_user_settings` (
`id_users` bigint(20) unsigned NOT NULL, `id_users` BIGINT(20) UNSIGNED NOT NULL,
`username` varchar(256) DEFAULT NULL, `username` VARCHAR(256) DEFAULT NULL,
`password` varchar(512) DEFAULT NULL, `password` VARCHAR(512) DEFAULT NULL,
`salt` varchar(512) DEFAULT NULL, `salt` VARCHAR(512) DEFAULT NULL,
`working_plan` text, `working_plan` TEXT,
`notifications` tinyint(4) DEFAULT '0', `notifications` TINYINT(4) DEFAULT '0',
`google_sync` tinyint(4) DEFAULT '0', `google_sync` TINYINT(4) DEFAULT '0',
`google_token` text, `google_token` TEXT,
`google_calendar` varchar(128) DEFAULT NULL, `google_calendar` VARCHAR(128) DEFAULT NULL,
`sync_past_days` int(11) DEFAULT '5', `sync_past_days` INT(11) DEFAULT '5',
`sync_future_days` int(11) DEFAULT '5', `sync_future_days` INT(11) DEFAULT '5',
`calendar_view` varchar(32) DEFAULT 'default', `calendar_view` VARCHAR(32) DEFAULT 'default',
PRIMARY KEY (`id_users`) PRIMARY KEY (`id_users`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;