mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-10 01:52:22 +03:00
Added ea_migrations table.
This commit is contained in:
parent
8df2e51a73
commit
fdd309c9d5
4 changed files with 168 additions and 101 deletions
|
@ -27,6 +27,12 @@ CREATE TABLE `ea_appointments` (
|
|||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
CREATE TABLE `ea_migrations` (
|
||||
`version` INT(11) NOT NULL
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
CREATE TABLE `ea_roles` (
|
||||
`id` INT(11) AUTO_INCREMENT NOT NULL,
|
||||
`name` VARCHAR(256) DEFAULT NULL,
|
||||
|
|
|
@ -11,6 +11,21 @@
|
|||
$config['migration_enabled'] = TRUE;
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the name of the table that will store the current migrations state.
|
||||
| When migrations runs it will store in a database table which migration
|
||||
| level the system is at. It then compares the migration level in this
|
||||
| table to the $config['migration_version'] if they are not the same it
|
||||
| will migrate up. This must be set.
|
||||
|
|
||||
*/
|
||||
$config['migration_table'] = 'ea_migrations';
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations version
|
||||
|
|
|
@ -16,3 +16,5 @@ VALUES
|
|||
('customer_notifications', '1'),
|
||||
('date_format', 'DMY'),
|
||||
('require_captcha', '0');
|
||||
|
||||
INSERT INTO `ea_migrations` VALUES ('8');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ea_appointments` (
|
||||
|
@ -17,9 +17,17 @@ 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;
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
|
||||
CREATE TABLE `ea_migrations` (
|
||||
`version` INT(11) NOT NULL
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ea_roles` (
|
||||
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(256),
|
||||
|
@ -32,23 +40,27 @@ CREATE TABLE IF NOT EXISTS `ea_roles` (
|
|||
`system_settings` INT(4),
|
||||
`user_settings` INT(11),
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
|
||||
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`),
|
||||
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;
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ea_services` (
|
||||
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(256),
|
||||
`duration` INT(11),
|
||||
`price` DECIMAL(10,2),
|
||||
`price` DECIMAL(10, 2),
|
||||
`currency` VARCHAR(32),
|
||||
`description` TEXT,
|
||||
`availabilities_type` VARCHAR(32) DEFAULT 'flexible',
|
||||
|
@ -56,15 +68,19 @@ CREATE TABLE IF NOT EXISTS `ea_services` (
|
|||
`id_service_categories` BIGINT(20) UNSIGNED,
|
||||
PRIMARY KEY (`id`),
|
||||
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` (
|
||||
`id_users` 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`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ea_service_categories` (
|
||||
|
@ -72,7 +88,9 @@ CREATE TABLE IF NOT EXISTS `ea_service_categories` (
|
|||
`name` VARCHAR(256),
|
||||
`description` TEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ea_settings` (
|
||||
|
@ -80,7 +98,9 @@ CREATE TABLE IF NOT EXISTS `ea_settings` (
|
|||
`name` VARCHAR(512),
|
||||
`value` LONGTEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ea_users` (
|
||||
|
@ -98,7 +118,9 @@ 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;
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `ea_user_settings` (
|
||||
|
@ -115,33 +137,55 @@ CREATE TABLE IF NOT EXISTS `ea_user_settings` (
|
|||
`sync_future_days` INT(11) DEFAULT '5',
|
||||
`calendar_view` VARCHAR(32) DEFAULT 'default',
|
||||
PRIMARY KEY (`id_users`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue