Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore:less boilerplate heavy ios notifications #272

Merged
merged 8 commits into from
Oct 24, 2023

Conversation

CommanderStorm
Copy link
Member

currently, the ios part of the bakend has a lot of boilerplate which makes reasoning really difficult
=> this PR slimms this boilerplate a bit

@CommanderStorm CommanderStorm self-assigned this Oct 22, 2023
@CommanderStorm CommanderStorm changed the title Chore/less boilerplate ios Chore/less boilerplate heavy ios Oct 22, 2023
@CommanderStorm CommanderStorm changed the title Chore/less boilerplate heavy ios Chore/less boilerplate heavy ios notifications Oct 22, 2023
@Antonwy
Copy link
Collaborator

Antonwy commented Oct 23, 2023

So a lot of syntax/code style changes, probably someone with more experience in Go, can check which style is the most preferred...

@CommanderStorm CommanderStorm requested review from kordianbruck and removed request for Antonwy October 23, 2023 12:40
@CommanderStorm CommanderStorm changed the title Chore/less boilerplate heavy ios notifications chore:less boilerplate heavy ios notifications Oct 23, 2023
@github-actions
Copy link
Contributor

👀 Found the following differences in the sql schema:

Needed get from local to auto migration state
-- Modify "card" table
ALTER TABLE `card` DROP FOREIGN KEY `card_ibfk_1`, DROP FOREIGN KEY `card_ibfk_2`, DROP FOREIGN KEY `card_ibfk_3`;
-- Modify "card2tag" table
ALTER TABLE `card2tag` DROP FOREIGN KEY `card2tag_ibfk_1`, DROP FOREIGN KEY `card2tag_ibfk_2`;
-- Modify "card_box" table
ALTER TABLE `card_box` DROP FOREIGN KEY `card_box_ibfk_1`;
-- Modify "card_comment" table
ALTER TABLE `card_comment` DROP FOREIGN KEY `card_comment_ibfk_1`, DROP FOREIGN KEY `card_comment_ibfk_2`;
-- Modify "card_option" table
ALTER TABLE `card_option` DROP FOREIGN KEY `card_option_ibfk_1`;
-- Modify "chat_message" table
ALTER TABLE `chat_message` DROP FOREIGN KEY `FK_chat_message_chat_room`, DROP FOREIGN KEY `chat_message_ibfk_1`;
-- Modify "chat_room2members" table
ALTER TABLE `chat_room2members` DROP FOREIGN KEY `FK_chat_room2members_chat_room`, DROP FOREIGN KEY `chat_room2members_ibfk_2`;
-- Modify "crontab" table
ALTER TABLE `crontab` COLLATE utf8mb4_general_ci, MODIFY COLUMN `cron` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `interval` int NULL DEFAULT 7200, MODIFY COLUMN `lastRun` int NULL DEFAULT 0, MODIFY COLUMN `type` enum('news','mensa','movie','roomfinder','alarm','fileDownload','dishNameDownload','averageRatingComputation','iosNotifications','iosActivityReset','canteenHeadCount','newExamResultsHook') NULL, ADD PRIMARY KEY (`cron`), DROP INDEX `cron`;
-- Modify "device2stats" table
ALTER TABLE `device2stats` DROP FOREIGN KEY `device2stats_ibfk_2`;
-- Modify "devices" table
ALTER TABLE `devices` COLLATE utf8mb4_general_ci, MODIFY COLUMN `device` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `member` bigint NULL, MODIFY COLUMN `uuid` varchar(50) NULL, MODIFY COLUMN `lastAccess` timestamp NULL DEFAULT '0000-00-00 00:00:00', MODIFY COLUMN `lastApi` text NULL, MODIFY COLUMN `developer` enum('true','false') NULL DEFAULT 'false', MODIFY COLUMN `osVersion` text NULL, MODIFY COLUMN `appVersion` text NULL, MODIFY COLUMN `counter` int NULL DEFAULT 0, MODIFY COLUMN `pk` text NULL, MODIFY COLUMN `pkActive` enum('true','false') NULL DEFAULT 'false', MODIFY COLUMN `gcmToken` text NULL, MODIFY COLUMN `gcmStatus` varchar(200) NULL, MODIFY COLUMN `confirmationKey` varchar(35) NULL, DROP INDEX `uuid`, DROP FOREIGN KEY `devices_ibfk_1`;
-- Modify "dish" table
ALTER TABLE `dish` COLLATE utf8mb4_general_ci, MODIFY COLUMN `dish` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `name` text NOT NULL, MODIFY COLUMN `type` text NOT NULL;
-- Modify "dish2dishflags" table
ALTER TABLE `dish2dishflags` DROP FOREIGN KEY `dish2dishflags_ibfk_1`, DROP FOREIGN KEY `dish2dishflags_ibfk_2`;
-- Modify "dish2mensa" table
ALTER TABLE `dish2mensa` DROP FOREIGN KEY `dish2mensa_ibfk_1`, DROP FOREIGN KEY `dish2mensa_ibfk_2`;
-- Modify "event" table
ALTER TABLE `event` DROP FOREIGN KEY `fkEventFile`, DROP FOREIGN KEY `fkEventGroup`, DROP FOREIGN KEY `fkKino`, DROP FOREIGN KEY `fkNews`;
-- Modify "feedback" table
ALTER TABLE `feedback` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `email_id` text NULL, MODIFY COLUMN `receiver` text NULL, MODIFY COLUMN `reply_to` text NULL, MODIFY COLUMN `feedback` text NULL, MODIFY COLUMN `image_count` int NOT NULL, MODIFY COLUMN `latitude` double NULL, MODIFY COLUMN `longitude` double NULL, MODIFY COLUMN `timestamp` timestamp NULL DEFAULT (current_timestamp());
-- Modify "files" table
ALTER TABLE `files` COLLATE utf8mb4_general_ci, MODIFY COLUMN `file` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `name` text NULL, MODIFY COLUMN `path` text NULL, MODIFY COLUMN `downloads` int NULL DEFAULT 0, MODIFY COLUMN `url` varchar(191) NULL;
-- Modify "ios_encrypted_grades" table
ALTER TABLE `ios_encrypted_grades` DROP FOREIGN KEY `fk_ios_encrypted_grades_device`;
-- Modify "kino" table
ALTER TABLE `kino` COLLATE utf8mb4_general_ci, MODIFY COLUMN `kino` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `title` text NOT NULL, MODIFY COLUMN `year` varchar(4) NOT NULL, MODIFY COLUMN `runtime` varchar(40) NOT NULL, MODIFY COLUMN `genre` varchar(100) NOT NULL, MODIFY COLUMN `director` text NOT NULL, MODIFY COLUMN `actors` text NOT NULL, MODIFY COLUMN `rating` varchar(4) NOT NULL, MODIFY COLUMN `description` text NOT NULL, MODIFY COLUMN `cover` bigint NULL, MODIFY COLUMN `trailer` longtext NULL, MODIFY COLUMN `link` varchar(190) NOT NULL, ADD INDEX `fk_kino_file` (`cover`), DROP FOREIGN KEY `kino_ibfk_1`;
-- Modify "log" table
ALTER TABLE `log` DROP FOREIGN KEY `fkLog2Actions`, DROP FOREIGN KEY `fkLog2UsersAf`, DROP FOREIGN KEY `fkLog2UsersEx`;
-- Modify "members_card" table
ALTER TABLE `members_card` DROP FOREIGN KEY `members_card_ibfk_1`, DROP FOREIGN KEY `members_card_ibfk_2`, DROP FOREIGN KEY `members_card_ibfk_3`;
-- Modify "members_card_answer_history" table
ALTER TABLE `members_card_answer_history` DROP FOREIGN KEY `members_card_answer_history_ibfk_1`, DROP FOREIGN KEY `members_card_answer_history_ibfk_2`, DROP FOREIGN KEY `members_card_answer_history_ibfk_3`;
-- Modify "menu" table
ALTER TABLE `menu` DROP FOREIGN KEY `menu_ibfk_1`;
-- Modify "modules" table
ALTER TABLE `modules` DROP FOREIGN KEY `fkMod2Rights`;
-- Modify "news" table
ALTER TABLE `news` COLLATE utf8mb4_general_ci, MODIFY COLUMN `news` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `date` datetime NULL, MODIFY COLUMN `created` timestamp NULL DEFAULT (current_timestamp()), MODIFY COLUMN `title` text NULL, MODIFY COLUMN `description` text NULL, MODIFY COLUMN `src` bigint NULL, MODIFY COLUMN `link` varchar(190) NULL, MODIFY COLUMN `image` text NULL, MODIFY COLUMN `file` bigint NULL, DROP INDEX `link`, ADD INDEX `fk_news_file` (`file`), ADD INDEX `fk_news_news_source` (`src`), DROP FOREIGN KEY `news_ibfk_1`, DROP FOREIGN KEY `news_ibfk_2`;
-- Modify "newsSource" table
ALTER TABLE `newsSource` COLLATE utf8mb4_general_ci, MODIFY COLUMN `source` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `title` text NULL, MODIFY COLUMN `url` text NULL, MODIFY COLUMN `icon` bigint NOT NULL, MODIFY COLUMN `hook` char(1) NULL, ADD INDEX `fk_newsSource_file` (`icon`), DROP FOREIGN KEY `newsSource_ibfk_1`;
-- Modify "news_alert" table
ALTER TABLE `news_alert` MODIFY COLUMN `news_alert` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `file` bigint NOT NULL, MODIFY COLUMN `created` timestamp NULL DEFAULT (current_timestamp()), MODIFY COLUMN `from` datetime NULL DEFAULT (current_timestamp()), MODIFY COLUMN `to` datetime NULL DEFAULT (current_timestamp()), DROP INDEX `FK_File`, ADD INDEX `fk_news_alert_file` (`file`);
-- Modify "notification" table
ALTER TABLE `notification` DROP FOREIGN KEY `notification_ibfk_1`, DROP FOREIGN KEY `notification_ibfk_2`;
-- Modify "notification_confirmation" table
ALTER TABLE `notification_confirmation` DROP FOREIGN KEY `notification_confirmation_ibfk_1`, DROP FOREIGN KEY `notification_confirmation_ibfk_2`;
-- Modify "question2faculty" table
ALTER TABLE `question2faculty` DROP FOREIGN KEY `question2faculty_ibfk_1`, DROP FOREIGN KEY `question2faculty_ibfk_2`;
-- Modify "recover" table
ALTER TABLE `recover` DROP FOREIGN KEY `fkRecover2User`;
-- Modify "reports" table
ALTER TABLE `reports` DROP FOREIGN KEY `reports_ibfk_3`;
-- Modify "roles2rights" table
ALTER TABLE `roles2rights` DROP FOREIGN KEY `fkRight`, DROP FOREIGN KEY `fkRole`;
-- Modify "ticket_admin2group" table
ALTER TABLE `ticket_admin2group` DROP FOREIGN KEY `fkTicketAdmin`, DROP FOREIGN KEY `fkTicketGroup`;
-- Modify "ticket_history" table
ALTER TABLE `ticket_history` DROP FOREIGN KEY `fkMember`, DROP FOREIGN KEY `fkTicketPayment`, DROP FOREIGN KEY `fkTicketType`;
-- Modify "ticket_type" table
ALTER TABLE `ticket_type` DROP FOREIGN KEY `fkEvent`, DROP FOREIGN KEY `fkPayment`;
-- Modify "update_note" table
ALTER TABLE `update_note` MODIFY COLUMN `version_code` bigint NOT NULL AUTO_INCREMENT;
-- Modify "users2info" table
ALTER TABLE `users2info` DROP FOREIGN KEY `fkUsers`;
-- Modify "users2roles" table
ALTER TABLE `users2roles` DROP FOREIGN KEY `fkUser2RolesRole`, DROP FOREIGN KEY `fkUser2RolesUser`;
-- Create "notifications" table
CREATE TABLE `notifications` (
  `notification` bigint NOT NULL AUTO_INCREMENT,
  `type` int NULL,
  `location` bigint NULL,
  `title` text NULL,
  `description` text NULL,
  `created` timestamp NULL DEFAULT (current_timestamp()),
  `signature` text NULL,
  `silent` tinyint NULL DEFAULT 0,
  PRIMARY KEY (`notification`)
) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
-- Create "notification_confirmations" table
CREATE TABLE `notification_confirmations` (
  `notification` bigint NOT NULL,
  `device` bigint NOT NULL,
  `sent` tinyint NULL DEFAULT 0,
  `created` timestamp NULL DEFAULT (current_timestamp()),
  `received` timestamp NULL,
  PRIMARY KEY (`notification`, `device`)
) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
-- Create "notification_types" table
CREATE TABLE `notification_types` (
  `type` bigint NOT NULL AUTO_INCREMENT,
  `name` text NULL,
  `confirmation` enum('true','false') NULL DEFAULT 'false',
  PRIMARY KEY (`type`)
) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
-- Drop "actions" table
DROP TABLE `actions`;
-- Drop "alarm_ban" table
DROP TABLE `alarm_ban`;
-- Drop "alarm_log" table
DROP TABLE `alarm_log`;
-- Drop "barrierFree_moreInfo" table
DROP TABLE `barrierFree_moreInfo`;
-- Drop "barrierFree_persons" table
DROP TABLE `barrierFree_persons`;
-- Drop "card" table
DROP TABLE `card`;
-- Drop "card2tag" table
DROP TABLE `card2tag`;
-- Drop "card_box" table
DROP TABLE `card_box`;
-- Drop "card_comment" table
DROP TABLE `card_comment`;
-- Drop "card_option" table
DROP TABLE `card_option`;
-- Drop "card_type" table
DROP TABLE `card_type`;
-- Drop "chat_message" table
DROP TABLE `chat_message`;
-- Drop "chat_room" table
DROP TABLE `chat_room`;
-- Drop "chat_room2members" table
DROP TABLE `chat_room2members`;
-- Drop "curricula" table
DROP TABLE `curricula`;
-- Drop "device2stats" table
DROP TABLE `device2stats`;
-- Drop "dish2dishflags" table
DROP TABLE `dish2dishflags`;
-- Drop "dish2mensa" table
DROP TABLE `dish2mensa`;
-- Drop "dishflags" table
DROP TABLE `dishflags`;
-- Drop "event" table
DROP TABLE `event`;
-- Drop "faculty" table
DROP TABLE `faculty`;
-- Drop "ios_encrypted_grades" table
DROP TABLE `ios_encrypted_grades`;
-- Modify "kino" table
ALTER TABLE `kino` ADD CONSTRAINT `fk_kino_file` FOREIGN KEY (`cover`) REFERENCES `files` (`file`) ON UPDATE RESTRICT ON DELETE RESTRICT;
-- Drop "lecture" table
DROP TABLE `lecture`;
-- Drop "location" table
DROP TABLE `location`;
-- Drop "log" table
DROP TABLE `log`;
-- Drop "member" table
DROP TABLE `member`;
-- Drop "members_card" table
DROP TABLE `members_card`;
-- Drop "members_card_answer_history" table
DROP TABLE `members_card_answer_history`;
-- Drop "mensa" table
DROP TABLE `mensa`;
-- Drop "mensaplan_mensa" table
DROP TABLE `mensaplan_mensa`;
-- Drop "mensaprices" table
DROP TABLE `mensaprices`;
-- Drop "menu" table
DROP TABLE `menu`;
-- Drop "migrations" table
DROP TABLE `migrations`;
-- Drop "modules" table
DROP TABLE `modules`;
-- Modify "news" table
ALTER TABLE `news` ADD CONSTRAINT `fk_news_file` FOREIGN KEY (`file`) REFERENCES `files` (`file`) ON UPDATE CASCADE ON DELETE CASCADE, ADD CONSTRAINT `fk_news_news_source` FOREIGN KEY (`src`) REFERENCES `newsSource` (`source`) ON UPDATE CASCADE ON DELETE CASCADE;
-- Modify "newsSource" table
ALTER TABLE `newsSource` ADD CONSTRAINT `fk_newsSource_file` FOREIGN KEY (`icon`) REFERENCES `files` (`file`) ON UPDATE CASCADE ON DELETE CASCADE;
-- Modify "news_alert" table
ALTER TABLE `news_alert` ADD CONSTRAINT `fk_news_alert_file` FOREIGN KEY (`file`) REFERENCES `files` (`file`) ON UPDATE CASCADE ON DELETE CASCADE;
-- Drop "notification" table
DROP TABLE `notification`;
-- Drop "notification_confirmation" table
DROP TABLE `notification_confirmation`;
-- Drop "notification_type" table
DROP TABLE `notification_type`;
-- Drop "openinghours" table
DROP TABLE `openinghours`;
-- Drop "question" table
DROP TABLE `question`;
-- Drop "question2answer" table
DROP TABLE `question2answer`;
-- Drop "question2faculty" table
DROP TABLE `question2faculty`;
-- Drop "questionAnswers" table
DROP TABLE `questionAnswers`;
-- Drop "recover" table
DROP TABLE `recover`;
-- Drop "reports" table
DROP TABLE `reports`;
-- Drop "rights" table
DROP TABLE `rights`;
-- Drop "roles" table
DROP TABLE `roles`;
-- Drop "roles2rights" table
DROP TABLE `roles2rights`;
-- Drop "roomfinder_building2area" table
DROP TABLE `roomfinder_building2area`;
-- Drop "roomfinder_buildings" table
DROP TABLE `roomfinder_buildings`;
-- Drop "roomfinder_buildings2gps" table
DROP TABLE `roomfinder_buildings2gps`;
-- Drop "roomfinder_buildings2maps" table
DROP TABLE `roomfinder_buildings2maps`;
-- Drop "roomfinder_maps" table
DROP TABLE `roomfinder_maps`;
-- Drop "roomfinder_rooms" table
DROP TABLE `roomfinder_rooms`;
-- Drop "roomfinder_rooms2maps" table
DROP TABLE `roomfinder_rooms2maps`;
-- Drop "roomfinder_schedules" table
DROP TABLE `roomfinder_schedules`;
-- Drop "sessions" table
DROP TABLE `sessions`;
-- Drop "tag" table
DROP TABLE `tag`;
-- Drop "ticket_admin" table
DROP TABLE `ticket_admin`;
-- Drop "ticket_admin2group" table
DROP TABLE `ticket_admin2group`;
-- Drop "ticket_group" table
DROP TABLE `ticket_group`;
-- Drop "ticket_history" table
DROP TABLE `ticket_history`;
-- Drop "ticket_payment" table
DROP TABLE `ticket_payment`;
-- Drop "ticket_type" table
DROP TABLE `ticket_type`;
-- Drop "users" table
DROP TABLE `users`;
-- Drop "users2info" table
DROP TABLE `users2info`;
-- Drop "users2roles" table
DROP TABLE `users2roles`;
-- Drop "wifi_measurement" table
DROP TABLE `wifi_measurement`;
Needed from auto to local migration state
-- Modify "card" table
ALTER TABLE `card` DROP FOREIGN KEY `card_ibfk_1`, DROP FOREIGN KEY `card_ibfk_2`, DROP FOREIGN KEY `card_ibfk_3`;
-- Modify "card2tag" table
ALTER TABLE `card2tag` DROP FOREIGN KEY `card2tag_ibfk_1`, DROP FOREIGN KEY `card2tag_ibfk_2`;
-- Modify "card_box" table
ALTER TABLE `card_box` DROP FOREIGN KEY `card_box_ibfk_1`;
-- Modify "card_comment" table
ALTER TABLE `card_comment` DROP FOREIGN KEY `card_comment_ibfk_1`, DROP FOREIGN KEY `card_comment_ibfk_2`;
-- Modify "card_option" table
ALTER TABLE `card_option` DROP FOREIGN KEY `card_option_ibfk_1`;
-- Modify "chat_message" table
ALTER TABLE `chat_message` DROP FOREIGN KEY `FK_chat_message_chat_room`, DROP FOREIGN KEY `chat_message_ibfk_1`;
-- Modify "chat_room2members" table
ALTER TABLE `chat_room2members` DROP FOREIGN KEY `FK_chat_room2members_chat_room`, DROP FOREIGN KEY `chat_room2members_ibfk_2`;
-- Modify "crontab" table
ALTER TABLE `crontab` COLLATE utf8mb4_general_ci, MODIFY COLUMN `cron` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `interval` int NULL DEFAULT 7200, MODIFY COLUMN `lastRun` int NULL DEFAULT 0, MODIFY COLUMN `type` enum('news','mensa','movie','roomfinder','alarm','fileDownload','dishNameDownload','averageRatingComputation','iosNotifications','iosActivityReset','canteenHeadCount','newExamResultsHook') NULL, ADD PRIMARY KEY (`cron`), DROP INDEX `cron`;
-- Modify "device2stats" table
ALTER TABLE `device2stats` DROP FOREIGN KEY `device2stats_ibfk_2`;
-- Modify "devices" table
ALTER TABLE `devices` COLLATE utf8mb4_general_ci, MODIFY COLUMN `device` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `member` bigint NULL, MODIFY COLUMN `uuid` varchar(50) NULL, MODIFY COLUMN `lastAccess` timestamp NULL DEFAULT '0000-00-00 00:00:00', MODIFY COLUMN `lastApi` text NULL, MODIFY COLUMN `developer` enum('true','false') NULL DEFAULT 'false', MODIFY COLUMN `osVersion` text NULL, MODIFY COLUMN `appVersion` text NULL, MODIFY COLUMN `counter` int NULL DEFAULT 0, MODIFY COLUMN `pk` text NULL, MODIFY COLUMN `pkActive` enum('true','false') NULL DEFAULT 'false', MODIFY COLUMN `gcmToken` text NULL, MODIFY COLUMN `gcmStatus` varchar(200) NULL, MODIFY COLUMN `confirmationKey` varchar(35) NULL, DROP INDEX `uuid`, DROP FOREIGN KEY `devices_ibfk_1`;
-- Modify "dish" table
ALTER TABLE `dish` COLLATE utf8mb4_general_ci, MODIFY COLUMN `dish` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `name` text NOT NULL, MODIFY COLUMN `type` text NOT NULL;
-- Modify "dish2dishflags" table
ALTER TABLE `dish2dishflags` DROP FOREIGN KEY `dish2dishflags_ibfk_1`, DROP FOREIGN KEY `dish2dishflags_ibfk_2`;
-- Modify "dish2mensa" table
ALTER TABLE `dish2mensa` DROP FOREIGN KEY `dish2mensa_ibfk_1`, DROP FOREIGN KEY `dish2mensa_ibfk_2`;
-- Modify "event" table
ALTER TABLE `event` DROP FOREIGN KEY `fkEventFile`, DROP FOREIGN KEY `fkEventGroup`, DROP FOREIGN KEY `fkKino`, DROP FOREIGN KEY `fkNews`;
-- Modify "feedback" table
ALTER TABLE `feedback` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `email_id` text NULL, MODIFY COLUMN `receiver` text NULL, MODIFY COLUMN `reply_to` text NULL, MODIFY COLUMN `feedback` text NULL, MODIFY COLUMN `image_count` int NOT NULL, MODIFY COLUMN `latitude` double NULL, MODIFY COLUMN `longitude` double NULL, MODIFY COLUMN `timestamp` timestamp NULL DEFAULT (current_timestamp());
-- Modify "files" table
ALTER TABLE `files` COLLATE utf8mb4_general_ci, MODIFY COLUMN `file` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `name` text NULL, MODIFY COLUMN `path` text NULL, MODIFY COLUMN `downloads` int NULL DEFAULT 0, MODIFY COLUMN `url` varchar(191) NULL;
-- Modify "ios_encrypted_grades" table
ALTER TABLE `ios_encrypted_grades` DROP FOREIGN KEY `fk_ios_encrypted_grades_device`;
-- Modify "kino" table
ALTER TABLE `kino` COLLATE utf8mb4_general_ci, MODIFY COLUMN `kino` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `title` text NOT NULL, MODIFY COLUMN `year` varchar(4) NOT NULL, MODIFY COLUMN `runtime` varchar(40) NOT NULL, MODIFY COLUMN `genre` varchar(100) NOT NULL, MODIFY COLUMN `director` text NOT NULL, MODIFY COLUMN `actors` text NOT NULL, MODIFY COLUMN `rating` varchar(4) NOT NULL, MODIFY COLUMN `description` text NOT NULL, MODIFY COLUMN `cover` bigint NULL, MODIFY COLUMN `trailer` longtext NULL, MODIFY COLUMN `link` varchar(190) NOT NULL, ADD INDEX `fk_kino_file` (`cover`), DROP FOREIGN KEY `kino_ibfk_1`;
-- Modify "log" table
ALTER TABLE `log` DROP FOREIGN KEY `fkLog2Actions`, DROP FOREIGN KEY `fkLog2UsersAf`, DROP FOREIGN KEY `fkLog2UsersEx`;
-- Modify "members_card" table
ALTER TABLE `members_card` DROP FOREIGN KEY `members_card_ibfk_1`, DROP FOREIGN KEY `members_card_ibfk_2`, DROP FOREIGN KEY `members_card_ibfk_3`;
-- Modify "members_card_answer_history" table
ALTER TABLE `members_card_answer_history` DROP FOREIGN KEY `members_card_answer_history_ibfk_1`, DROP FOREIGN KEY `members_card_answer_history_ibfk_2`, DROP FOREIGN KEY `members_card_answer_history_ibfk_3`;
-- Modify "menu" table
ALTER TABLE `menu` DROP FOREIGN KEY `menu_ibfk_1`;
-- Modify "modules" table
ALTER TABLE `modules` DROP FOREIGN KEY `fkMod2Rights`;
-- Modify "news" table
ALTER TABLE `news` COLLATE utf8mb4_general_ci, MODIFY COLUMN `news` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `date` datetime NULL, MODIFY COLUMN `created` timestamp NULL DEFAULT (current_timestamp()), MODIFY COLUMN `title` text NULL, MODIFY COLUMN `description` text NULL, MODIFY COLUMN `src` bigint NULL, MODIFY COLUMN `link` varchar(190) NULL, MODIFY COLUMN `image` text NULL, MODIFY COLUMN `file` bigint NULL, DROP INDEX `link`, ADD INDEX `fk_news_file` (`file`), ADD INDEX `fk_news_news_source` (`src`), DROP FOREIGN KEY `news_ibfk_1`, DROP FOREIGN KEY `news_ibfk_2`;
-- Modify "newsSource" table
ALTER TABLE `newsSource` COLLATE utf8mb4_general_ci, MODIFY COLUMN `source` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `title` text NULL, MODIFY COLUMN `url` text NULL, MODIFY COLUMN `icon` bigint NOT NULL, MODIFY COLUMN `hook` char(1) NULL, ADD INDEX `fk_newsSource_file` (`icon`), DROP FOREIGN KEY `newsSource_ibfk_1`;
-- Modify "news_alert" table
ALTER TABLE `news_alert` MODIFY COLUMN `news_alert` bigint NOT NULL AUTO_INCREMENT, MODIFY COLUMN `file` bigint NOT NULL, MODIFY COLUMN `created` timestamp NULL DEFAULT (current_timestamp()), MODIFY COLUMN `from` datetime NULL DEFAULT (current_timestamp()), MODIFY COLUMN `to` datetime NULL DEFAULT (current_timestamp()), DROP INDEX `FK_File`, ADD INDEX `fk_news_alert_file` (`file`);
-- Modify "notification" table
ALTER TABLE `notification` DROP FOREIGN KEY `notification_ibfk_1`, DROP FOREIGN KEY `notification_ibfk_2`;
-- Modify "notification_confirmation" table
ALTER TABLE `notification_confirmation` DROP FOREIGN KEY `notification_confirmation_ibfk_1`, DROP FOREIGN KEY `notification_confirmation_ibfk_2`;
-- Modify "question2faculty" table
ALTER TABLE `question2faculty` DROP FOREIGN KEY `question2faculty_ibfk_1`, DROP FOREIGN KEY `question2faculty_ibfk_2`;
-- Modify "recover" table
ALTER TABLE `recover` DROP FOREIGN KEY `fkRecover2User`;
-- Modify "reports" table
ALTER TABLE `reports` DROP FOREIGN KEY `reports_ibfk_3`;
-- Modify "roles2rights" table
ALTER TABLE `roles2rights` DROP FOREIGN KEY `fkRight`, DROP FOREIGN KEY `fkRole`;
-- Modify "ticket_admin2group" table
ALTER TABLE `ticket_admin2group` DROP FOREIGN KEY `fkTicketAdmin`, DROP FOREIGN KEY `fkTicketGroup`;
-- Modify "ticket_history" table
ALTER TABLE `ticket_history` DROP FOREIGN KEY `fkMember`, DROP FOREIGN KEY `fkTicketPayment`, DROP FOREIGN KEY `fkTicketType`;
-- Modify "ticket_type" table
ALTER TABLE `ticket_type` DROP FOREIGN KEY `fkEvent`, DROP FOREIGN KEY `fkPayment`;
-- Modify "update_note" table
ALTER TABLE `update_note` MODIFY COLUMN `version_code` bigint NOT NULL AUTO_INCREMENT;
-- Modify "users2info" table
ALTER TABLE `users2info` DROP FOREIGN KEY `fkUsers`;
-- Modify "users2roles" table
ALTER TABLE `users2roles` DROP FOREIGN KEY `fkUser2RolesRole`, DROP FOREIGN KEY `fkUser2RolesUser`;
-- Create "notifications" table
CREATE TABLE `notifications` (
  `notification` bigint NOT NULL AUTO_INCREMENT,
  `type` int NULL,
  `location` bigint NULL,
  `title` text NULL,
  `description` text NULL,
  `created` timestamp NULL DEFAULT (current_timestamp()),
  `signature` text NULL,
  `silent` tinyint NULL DEFAULT 0,
  PRIMARY KEY (`notification`)
) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
-- Create "notification_confirmations" table
CREATE TABLE `notification_confirmations` (
  `notification` bigint NOT NULL,
  `device` bigint NOT NULL,
  `sent` tinyint NULL DEFAULT 0,
  `created` timestamp NULL DEFAULT (current_timestamp()),
  `received` timestamp NULL,
  PRIMARY KEY (`notification`, `device`)
) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
-- Create "notification_types" table
CREATE TABLE `notification_types` (
  `type` bigint NOT NULL AUTO_INCREMENT,
  `name` text NULL,
  `confirmation` enum('true','false') NULL DEFAULT 'false',
  PRIMARY KEY (`type`)
) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
-- Drop "actions" table
DROP TABLE `actions`;
-- Drop "alarm_ban" table
DROP TABLE `alarm_ban`;
-- Drop "alarm_log" table
DROP TABLE `alarm_log`;
-- Drop "barrierFree_moreInfo" table
DROP TABLE `barrierFree_moreInfo`;
-- Drop "barrierFree_persons" table
DROP TABLE `barrierFree_persons`;
-- Drop "card" table
DROP TABLE `card`;
-- Drop "card2tag" table
DROP TABLE `card2tag`;
-- Drop "card_box" table
DROP TABLE `card_box`;
-- Drop "card_comment" table
DROP TABLE `card_comment`;
-- Drop "card_option" table
DROP TABLE `card_option`;
-- Drop "card_type" table
DROP TABLE `card_type`;
-- Drop "chat_message" table
DROP TABLE `chat_message`;
-- Drop "chat_room" table
DROP TABLE `chat_room`;
-- Drop "chat_room2members" table
DROP TABLE `chat_room2members`;
-- Drop "curricula" table
DROP TABLE `curricula`;
-- Drop "device2stats" table
DROP TABLE `device2stats`;
-- Drop "dish2dishflags" table
DROP TABLE `dish2dishflags`;
-- Drop "dish2mensa" table
DROP TABLE `dish2mensa`;
-- Drop "dishflags" table
DROP TABLE `dishflags`;
-- Drop "event" table
DROP TABLE `event`;
-- Drop "faculty" table
DROP TABLE `faculty`;
-- Drop "ios_encrypted_grades" table
DROP TABLE `ios_encrypted_grades`;
-- Modify "kino" table
ALTER TABLE `kino` ADD CONSTRAINT `fk_kino_file` FOREIGN KEY (`cover`) REFERENCES `files` (`file`) ON UPDATE RESTRICT ON DELETE RESTRICT;
-- Drop "lecture" table
DROP TABLE `lecture`;
-- Drop "location" table
DROP TABLE `location`;
-- Drop "log" table
DROP TABLE `log`;
-- Drop "member" table
DROP TABLE `member`;
-- Drop "members_card" table
DROP TABLE `members_card`;
-- Drop "members_card_answer_history" table
DROP TABLE `members_card_answer_history`;
-- Drop "mensa" table
DROP TABLE `mensa`;
-- Drop "mensaplan_mensa" table
DROP TABLE `mensaplan_mensa`;
-- Drop "mensaprices" table
DROP TABLE `mensaprices`;
-- Drop "menu" table
DROP TABLE `menu`;
-- Drop "migrations" table
DROP TABLE `migrations`;
-- Drop "modules" table
DROP TABLE `modules`;
-- Modify "news" table
ALTER TABLE `news` ADD CONSTRAINT `fk_news_file` FOREIGN KEY (`file`) REFERENCES `files` (`file`) ON UPDATE CASCADE ON DELETE CASCADE, ADD CONSTRAINT `fk_news_news_source` FOREIGN KEY (`src`) REFERENCES `newsSource` (`source`) ON UPDATE CASCADE ON DELETE CASCADE;
-- Modify "newsSource" table
ALTER TABLE `newsSource` ADD CONSTRAINT `fk_newsSource_file` FOREIGN KEY (`icon`) REFERENCES `files` (`file`) ON UPDATE CASCADE ON DELETE CASCADE;
-- Modify "news_alert" table
ALTER TABLE `news_alert` ADD CONSTRAINT `fk_news_alert_file` FOREIGN KEY (`file`) REFERENCES `files` (`file`) ON UPDATE CASCADE ON DELETE CASCADE;
-- Drop "notification" table
DROP TABLE `notification`;
-- Drop "notification_confirmation" table
DROP TABLE `notification_confirmation`;
-- Drop "notification_type" table
DROP TABLE `notification_type`;
-- Drop "openinghours" table
DROP TABLE `openinghours`;
-- Drop "question" table
DROP TABLE `question`;
-- Drop "question2answer" table
DROP TABLE `question2answer`;
-- Drop "question2faculty" table
DROP TABLE `question2faculty`;
-- Drop "questionAnswers" table
DROP TABLE `questionAnswers`;
-- Drop "recover" table
DROP TABLE `recover`;
-- Drop "reports" table
DROP TABLE `reports`;
-- Drop "rights" table
DROP TABLE `rights`;
-- Drop "roles" table
DROP TABLE `roles`;
-- Drop "roles2rights" table
DROP TABLE `roles2rights`;
-- Drop "roomfinder_building2area" table
DROP TABLE `roomfinder_building2area`;
-- Drop "roomfinder_buildings" table
DROP TABLE `roomfinder_buildings`;
-- Drop "roomfinder_buildings2gps" table
DROP TABLE `roomfinder_buildings2gps`;
-- Drop "roomfinder_buildings2maps" table
DROP TABLE `roomfinder_buildings2maps`;
-- Drop "roomfinder_maps" table
DROP TABLE `roomfinder_maps`;
-- Drop "roomfinder_rooms" table
DROP TABLE `roomfinder_rooms`;
-- Drop "roomfinder_rooms2maps" table
DROP TABLE `roomfinder_rooms2maps`;
-- Drop "roomfinder_schedules" table
DROP TABLE `roomfinder_schedules`;
-- Drop "sessions" table
DROP TABLE `sessions`;
-- Drop "tag" table
DROP TABLE `tag`;
-- Drop "ticket_admin" table
DROP TABLE `ticket_admin`;
-- Drop "ticket_admin2group" table
DROP TABLE `ticket_admin2group`;
-- Drop "ticket_group" table
DROP TABLE `ticket_group`;
-- Drop "ticket_history" table
DROP TABLE `ticket_history`;
-- Drop "ticket_payment" table
DROP TABLE `ticket_payment`;
-- Drop "ticket_type" table
DROP TABLE `ticket_type`;
-- Drop "users" table
DROP TABLE `users`;
-- Drop "users2info" table
DROP TABLE `users2info`;
-- Drop "users2roles" table
DROP TABLE `users2roles`;
-- Drop "wifi_measurement" table
DROP TABLE `wifi_measurement`;

@CommanderStorm CommanderStorm enabled auto-merge (squash) October 24, 2023 18:11
@CommanderStorm CommanderStorm merged commit 4d668ae into main Oct 24, 2023
4 checks passed
@CommanderStorm CommanderStorm deleted the chore/less-boilerplate-ios branch October 24, 2023 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants