mirror of
https://github.com/ShaYmez/FreeSTAR-Status-Engine.git
synced 2024-11-30 08:08:38 -05:00
database modifications
This commit is contained in:
parent
554edc403a
commit
eabca6bb0c
27
install.sql
27
install.sql
@ -33,6 +33,18 @@ CREATE TABLE `users` (
|
||||
`permission` int(11) NOT NULL DEFAULT '0',
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;
|
||||
CREATE TABLE `subscribers` (
|
||||
`subscriberID` int(11) NOT NULL,
|
||||
`telegramID` int(50) NOT NULL,
|
||||
`firstname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`lastname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
CREATE TABLE `services_subscriber` (
|
||||
`comboID` int(11) NOT NULL,
|
||||
`subscriberIDFK` int(11) NOT NULL,
|
||||
`serviceIDFK` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
ALTER TABLE `services`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
ALTER TABLE `services_status`
|
||||
@ -57,6 +69,17 @@ ALTER TABLE `status`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `users`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `services_subscriber`
|
||||
ADD PRIMARY KEY (`comboID`),
|
||||
ADD UNIQUE KEY `unique_subscription` (`subscriberIDFK`,`serviceIDFK`),
|
||||
ADD KEY `serviceIDFK` (`serviceIDFK`);
|
||||
ALTER TABLE `subscribers`
|
||||
ADD PRIMARY KEY (`subscriberID`),
|
||||
ADD UNIQUE KEY `telegramID` (`telegramID`);
|
||||
ALTER TABLE `services_subscriber`
|
||||
MODIFY `comboID` int(11) NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `subscribers`
|
||||
MODIFY `subscriberID` int(11) NOT NULL AUTO_INCREMENT;
|
||||
ALTER TABLE `services_status`
|
||||
ADD CONSTRAINT `service_id` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`),
|
||||
ADD CONSTRAINT `status_id` FOREIGN KEY (`status_id`) REFERENCES `status` (`id`);
|
||||
@ -64,3 +87,7 @@ ALTER TABLE `status`
|
||||
ADD CONSTRAINT `user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);
|
||||
ALTER TABLE `tokens`
|
||||
ADD CONSTRAINT `user` FOREIGN KEY (`user`) REFERENCES `users` (`id`);
|
||||
ALTER TABLE `services_subscriber`
|
||||
ADD CONSTRAINT `services_subscriber_ibfk_1` FOREIGN KEY (`subscriberIDFK`) REFERENCES `subscribers` (`subscriberID`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT `services_subscriber_ibfk_2` FOREIGN KEY (`serviceIDFK`) REFERENCES `services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
COMMIT;
|
||||
|
Loading…
Reference in New Issue
Block a user