Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Структура на таблицата accounts
- CREATE TABLE IF NOT EXISTS `accounts` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `plan_id` int(11) DEFAULT NULL,
- `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `is_active` tinyint(1) NOT NULL,
- `is_main` tinyint(1) NOT NULL,
- `date_register` datetime NOT NULL,
- PRIMARY KEY (`id`),
- KEY `IDX_CAC89EACE899029B` (`plan_id`),
- CONSTRAINT `FK_CAC89EACE899029B` FOREIGN KEY (`plan_id`) REFERENCES `plans` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- Структура на таблицата cities
- CREATE TABLE IF NOT EXISTS `cities` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `seo_link` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=297 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- Структура на таблицата clients
- CREATE TABLE IF NOT EXISTS `clients` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `company_id` int(11) NOT NULL,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `date_added` datetime NOT NULL,
- `city_id` int(11) DEFAULT NULL,
- `note` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `address` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `send_notifications` tinyint(1) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `IDX_C82E74979B1AD6` (`company_id`),
- KEY `IDX_C82E748BAC62AF` (`city_id`),
- CONSTRAINT `FK_C82E748BAC62AF` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`),
- CONSTRAINT `FK_C82E74979B1AD6` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- Структура на таблицата companies
- CREATE TABLE IF NOT EXISTS `companies` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `city_id` int(11) NOT NULL,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `slug` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `address` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `date_added` datetime NOT NULL,
- `working_time` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `IDX_8244AA3A8BAC62AF` (`city_id`),
- CONSTRAINT `FK_8244AA3A8BAC62AF` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- Структура на таблицата company_accounts
- CREATE TABLE IF NOT EXISTS `company_accounts` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `account_id` int(11) NOT NULL,
- `company_id` int(11) NOT NULL,
- `staff_access` tinyint(1) NOT NULL,
- `staff_manage` tinyint(1) NOT NULL,
- `service_access` tinyint(1) NOT NULL,
- `service_manage` tinyint(1) NOT NULL,
- `client_access` tinyint(1) NOT NULL,
- `client_manage` tinyint(1) NOT NULL,
- `main_access` tinyint(1) NOT NULL,
- `possition` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `working_time` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `event_access` tinyint(1) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `IDX_D25F8BC19B6B5FBA` (`account_id`),
- KEY `IDX_D25F8BC1979B1AD6` (`company_id`),
- CONSTRAINT `FK_D25F8BC1979B1AD6` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`),
- CONSTRAINT `FK_D25F8BC19B6B5FBA` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- Структура на таблицата events
- CREATE TABLE IF NOT EXISTS `events` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `company_id` int(11) NOT NULL,
- `provider_id` int(11) NOT NULL,
- `service_id` int(11) NOT NULL,
- `created_by_id` int(11) NOT NULL,
- `client_id` int(11) NOT NULL,
- `start` datetime NOT NULL,
- `end` datetime NOT NULL,
- `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `date_created` datetime NOT NULL,
- `status` int(11) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `IDX_5387574A979B1AD6` (`company_id`),
- KEY `IDX_5387574AA53A8AA` (`provider_id`),
- KEY `IDX_5387574AED5CA9E6` (`service_id`),
- KEY `IDX_5387574AB03A8386` (`created_by_id`),
- KEY `IDX_5387574A19EB6921` (`client_id`),
- CONSTRAINT `FK_5387574A19EB6921` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
- CONSTRAINT `FK_5387574A979B1AD6` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`),
- CONSTRAINT `FK_5387574AA53A8AA` FOREIGN KEY (`provider_id`) REFERENCES `accounts` (`id`),
- CONSTRAINT `FK_5387574AB03A8386` FOREIGN KEY (`created_by_id`) REFERENCES `accounts` (`id`),
- CONSTRAINT `FK_5387574AED5CA9E6` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- Структура на таблицата messages
- CREATE TABLE IF NOT EXISTS `messages` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `receiver_id` int(11) NOT NULL,
- `sender_id` int(11) NOT NULL,
- `subject` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `message` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
- `is_reply` int(11) NOT NULL,
- `is_read` int(11) NOT NULL,
- `sender_delete` int(11) NOT NULL,
- `receiver_delete` int(11) NOT NULL,
- `date_send` datetime NOT NULL,
- PRIMARY KEY (`id`),
- KEY `IDX_DB021E96CD53EDB6` (`receiver_id`),
- KEY `IDX_DB021E96F624B39D` (`sender_id`),
- CONSTRAINT `FK_DB021E96CD53EDB6` FOREIGN KEY (`receiver_id`) REFERENCES `accounts` (`id`),
- CONSTRAINT `FK_DB021E96F624B39D` FOREIGN KEY (`sender_id`) REFERENCES `accounts` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- Структура на таблицата notes
- CREATE TABLE IF NOT EXISTS `notes` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `account_id` int(11) NOT NULL,
- `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
- `date_added` datetime NOT NULL,
- PRIMARY KEY (`id`),
- KEY `IDX_11BA68C9B6B5FBA` (`account_id`),
- CONSTRAINT `FK_11BA68C9B6B5FBA` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- Структура на таблицата plans
- CREATE TABLE IF NOT EXISTS `plans` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `companies_limit` int(11) NOT NULL,
- `staffs_limit` int(11) NOT NULL,
- `price` double NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- Структура на таблицата requests
- CREATE TABLE IF NOT EXISTS `requests` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `account_id` int(11) NOT NULL,
- `request_from_id` int(11) NOT NULL,
- `request_key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `type` int(11) NOT NULL,
- `date_created` datetime NOT NULL,
- `date_expired` datetime NOT NULL,
- PRIMARY KEY (`id`),
- KEY `IDX_7B85D6519B6B5FBA` (`account_id`),
- KEY `IDX_7B85D65152EAAB5C` (`request_from_id`),
- CONSTRAINT `FK_7B85D65152EAAB5C` FOREIGN KEY (`request_from_id`) REFERENCES `accounts` (`id`),
- CONSTRAINT `FK_7B85D6519B6B5FBA` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=82 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- Структура на таблицата services
- CREATE TABLE IF NOT EXISTS `services` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `company_id` int(11) NOT NULL,
- `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
- `description` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
- `cost` double NOT NULL,
- `time` int(11) NOT NULL,
- `is_private` tinyint(1) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `IDX_7332E169979B1AD6` (`company_id`),
- CONSTRAINT `FK_7332E169979B1AD6` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- -- Структура на таблицата service_providers
- CREATE TABLE IF NOT EXISTS `service_providers` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `account_id` int(11) NOT NULL,
- `service_id` int(11) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `IDX_BAB4EE5D9B6B5FBA` (`account_id`),
- KEY `IDX_BAB4EE5DED5CA9E6` (`service_id`),
- CONSTRAINT `FK_BAB4EE5D9B6B5FBA` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`),
- CONSTRAINT `FK_BAB4EE5DED5CA9E6` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement