diff --git a/README.md b/README.md index 7058417..74251dd 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,9 @@ It will ask you to run in sudo mode in order to execute the sql. ## How to run it -- `./gradlew bootRun` +- IDE: Most recent IDEs can run gradle, use its capabilities. + +- Command line: `./gradlew bootRun` ## Tests diff --git a/src/main/java/org/worldcubeassociation/dbsanitycheck/model/Category.java b/src/main/java/org/worldcubeassociation/dbsanitycheck/model/Category.java index fbf9675..99b2458 100644 --- a/src/main/java/org/worldcubeassociation/dbsanitycheck/model/Category.java +++ b/src/main/java/org/worldcubeassociation/dbsanitycheck/model/Category.java @@ -1,17 +1,21 @@ package org.worldcubeassociation.dbsanitycheck.model; +import lombok.Data; + +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; -import lombok.Data; - @Data @Entity @Table(name = "sanity_check_categories") public class Category { - @Id - private Integer id; + @Id + private Integer id; + + private String name; - private String name; + @Column(name = "email_to") + private String emailTo; } diff --git a/src/main/java/org/worldcubeassociation/dbsanitycheck/service/EmailService.java b/src/main/java/org/worldcubeassociation/dbsanitycheck/service/EmailService.java index 840ab60..c9b3b63 100644 --- a/src/main/java/org/worldcubeassociation/dbsanitycheck/service/EmailService.java +++ b/src/main/java/org/worldcubeassociation/dbsanitycheck/service/EmailService.java @@ -1,14 +1,13 @@ package org.worldcubeassociation.dbsanitycheck.service; -import java.util.List; - -import javax.mail.MessagingException; - import org.worldcubeassociation.dbsanitycheck.bean.AnalysisBean; import org.worldcubeassociation.dbsanitycheck.bean.SanityCheckWithErrorBean; +import java.util.List; +import javax.mail.MessagingException; + @FunctionalInterface public interface EmailService { - void sendEmail(List analysisResult, List queriesWithError) - throws MessagingException; + void sendEmail(String emailTo, List analysisResult, List queriesWithError) + throws MessagingException; } diff --git a/src/main/java/org/worldcubeassociation/dbsanitycheck/service/impl/EmailServiceImpl.java b/src/main/java/org/worldcubeassociation/dbsanitycheck/service/impl/EmailServiceImpl.java index 12d0305..33fc830 100644 --- a/src/main/java/org/worldcubeassociation/dbsanitycheck/service/impl/EmailServiceImpl.java +++ b/src/main/java/org/worldcubeassociation/dbsanitycheck/service/impl/EmailServiceImpl.java @@ -4,7 +4,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ByteArrayResource; -import org.springframework.core.io.FileSystemResource; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.stereotype.Service; @@ -14,7 +13,6 @@ import org.worldcubeassociation.dbsanitycheck.service.EmailService; import org.worldcubeassociation.dbsanitycheck.service.ExclusionService; -import java.io.File; import java.time.LocalDate; import java.util.List; import javax.mail.MessagingException; @@ -30,18 +28,12 @@ public class EmailServiceImpl implements EmailService { @Value("${service.mail.send}") private boolean sendMail; - @Value("${service.mail.to}") - private String mailTo; - @Value("${service.mail.from}") private String mailFrom; @Value("${service.mail.subject}") private String subject; - @Value("${service.mail.logfilepath}") - private String logFilePath; - @Autowired private JavaMailSender emailSender; @@ -51,9 +43,10 @@ public class EmailServiceImpl implements EmailService { private static final boolean MULTIPART = true; @Override - public void sendEmail(List analysisResult, List queriesWithError) + public void sendEmail(String emailTo, List analysisResult, + List queriesWithError) throws MessagingException { - if (sendMail) { + if (sendMail && emailTo.length() > 0) { log.info("Sending email with the analysis"); MimeMessage message = emailSender.createMimeMessage(); @@ -61,22 +54,18 @@ public void sendEmail(List analysisResult, List analysisResult, List analysisResult = new ArrayList<>(); - - private List queriesWithError = new ArrayList<>(); @Override public void execute() throws MessagingException { @@ -49,17 +47,34 @@ public void execute() throws MessagingException { .findAll(Sort.by(Sort.Direction.ASC, "sanityCheckCategoryId", "topic")); log.info("Found {} queries", sanityChecks.size()); - executeSanityChecks(sanityChecks); - showResults(); + Map> sanityChecksByEmail = sanityChecks.stream() + .collect(Collectors.groupingBy(s -> Optional.ofNullable(s.getCategory().getEmailTo()).orElse(""))); + log.info("Found {} emails", sanityChecksByEmail.size()); + + for (Map.Entry> entry : sanityChecksByEmail.entrySet()) { + sendSanityChecksToEmail(entry.getKey(), entry.getValue()); + } + } + + private void sendSanityChecksToEmail(String email, List sanityChecks) throws MessagingException { + + // Hold inconsistencies + List analysisResult = new ArrayList<>(); + + List queriesWithError = new ArrayList<>(); + + executeSanityChecks(sanityChecks, analysisResult, queriesWithError); + showResults(analysisResult, queriesWithError); log.info("All queries executed"); - emailService.sendEmail(analysisResult, queriesWithError); + emailService.sendEmail(email, analysisResult, queriesWithError); log.info("Sanity check finished"); } - private void executeSanityChecks(List sanityChecks) { + private void executeSanityChecks(List sanityChecks, List analysisResult, + List queriesWithError) { log.info("Execute queries"); String prevCategory = null; @@ -72,14 +87,15 @@ private void executeSanityChecks(List sanityChecks) { prevCategory = category; } - generalAnalysis(sanityCheck); + generalAnalysis(sanityCheck, analysisResult, queriesWithError); } } /** * A general purpose analysis. If the query returns any value, it will be added to the result */ - private void generalAnalysis(SanityCheck sanityCheck) { + private void generalAnalysis(SanityCheck sanityCheck, List analysisResult, + List queriesWithError) { String topic = sanityCheck.getTopic(); String query = sanityCheck.getQuery(); @@ -194,7 +210,7 @@ private boolean partiallyEquals(JSONObject exclusion, JSONObject sanityCheckResu } - private void showResults() { + private void showResults(List analysisResult, List queriesWithError) { analysisResult.forEach(item -> { log.warn(" ** Inconsistency at [{}] {}", item.getSanityCheck().getCategory().getName(), item.getSanityCheck().getTopic()); diff --git a/src/main/resources/application-local.properties b/src/main/resources/application-local.properties index 98fb799..f3041fa 100644 --- a/src/main/resources/application-local.properties +++ b/src/main/resources/application-local.properties @@ -6,10 +6,8 @@ spring.datasource.password= spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect service.mail.send=false -service.mail.to=@mail.to@ service.mail.from=@mail.from@ service.mail.subject=Sanity Check -service.mail.logfilepath=log/db-sanity-check.log spring.mail.host=@mail.host@ spring.mail.port=587 diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index e0ee20e..60318ba 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -6,10 +6,8 @@ spring.datasource.password=@connectopm.dbwca@ spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect service.mail.send=true -service.mail.to=@mail.to@ service.mail.from=@mail.from@ service.mail.subject=Sanity Check -service.mail.logfilepath=log/db-sanity-check.log spring.mail.host=@mail.host@ spring.mail.port=587 diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties index e978976..3b54193 100644 --- a/src/main/resources/application-test.properties +++ b/src/main/resources/application-test.properties @@ -6,7 +6,5 @@ spring.datasource.password= spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect service.mail.send=true -service.mail.to=email@wca.com service.mail.from=email@wca.com service.mail.subject=Sanity Check -service.mail.logfilepath=log/db-sanity-check.log diff --git a/src/main/resources/db/migration/V20210810.0230__tables.sql b/src/main/resources/db/migration/V20210810.0230__tables.sql index bad969c..2244707 100644 --- a/src/main/resources/db/migration/V20210810.0230__tables.sql +++ b/src/main/resources/db/migration/V20210810.0230__tables.sql @@ -1,373 +1,25 @@ -- https://github.com/thewca/worldcubeassociation.org/blob/master/WcaOnRails/db/structure.sql -use wca_development; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; +/*!50503 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -DROP TABLE IF EXISTS `Competitions`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Competitions` ( - `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `cityName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `countryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `information` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `year` smallint(5) unsigned NOT NULL DEFAULT '0', - `month` smallint(5) unsigned NOT NULL DEFAULT '0', - `day` smallint(5) unsigned NOT NULL DEFAULT '0', - `endMonth` smallint(5) unsigned NOT NULL DEFAULT '0', - `endDay` smallint(5) unsigned NOT NULL DEFAULT '0', - `venue` varchar(240) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `venueAddress` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `venueDetails` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `external_website` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `cellName` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `showAtAll` tinyint(1) NOT NULL DEFAULT '0', - `latitude` int(11) DEFAULT NULL, - `longitude` int(11) DEFAULT NULL, - `contact` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `registration_open` datetime DEFAULT NULL, - `registration_close` datetime DEFAULT NULL, - `use_wca_registration` tinyint(1) NOT NULL DEFAULT '1', - `guests_enabled` tinyint(1) NOT NULL DEFAULT '1', - `results_posted_at` datetime DEFAULT NULL, - `results_nag_sent_at` datetime DEFAULT NULL, - `generate_website` tinyint(1) DEFAULT NULL, - `announced_at` datetime DEFAULT NULL, - `base_entry_fee_lowest_denomination` int(11) DEFAULT NULL, - `currency_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'USD', - `endYear` smallint(6) NOT NULL DEFAULT '0', - `connected_stripe_account_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `start_date` date DEFAULT NULL, - `end_date` date DEFAULT NULL, - `enable_donations` tinyint(1) DEFAULT NULL, - `competitor_limit_enabled` tinyint(1) DEFAULT NULL, - `competitor_limit` int(11) DEFAULT NULL, - `competitor_limit_reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `extra_registration_requirements` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `on_the_spot_registration` tinyint(1) DEFAULT NULL, - `on_the_spot_entry_fee_lowest_denomination` int(11) DEFAULT NULL, - `refund_policy_percent` int(11) DEFAULT NULL, - `refund_policy_limit_date` datetime DEFAULT NULL, - `guests_entry_fee_lowest_denomination` int(11) DEFAULT NULL, - `created_at` datetime DEFAULT NULL, - `updated_at` datetime DEFAULT NULL, - `results_submitted_at` datetime DEFAULT NULL, - `early_puzzle_submission` tinyint(1) DEFAULT NULL, - `early_puzzle_submission_reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `qualification_results` tinyint(1) DEFAULT NULL, - `qualification_results_reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `name_reason` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `external_registration_page` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `confirmed_at` datetime DEFAULT NULL, - `event_restrictions` tinyint(1) DEFAULT NULL, - `event_restrictions_reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `registration_reminder_sent_at` datetime DEFAULT NULL, - `announced_by` int(11) DEFAULT NULL, - `results_posted_by` int(11) DEFAULT NULL, - `main_event_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `cancelled_at` datetime DEFAULT NULL, - `cancelled_by` int(11) DEFAULT NULL, - `waiting_list_deadline_date` datetime DEFAULT NULL, - `event_change_deadline_date` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `year_month_day` (`year`,`month`,`day`), - KEY `index_Competitions_on_countryId` (`countryId`), - KEY `index_Competitions_on_start_date` (`start_date`), - KEY `index_Competitions_on_end_date` (`end_date`), - KEY `index_Competitions_on_cancelled_at` (`cancelled_at`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `CompetitionsMedia`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `CompetitionsMedia` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `competitionId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `type` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `text` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `uri` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `submitterName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `submitterComment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `submitterEmail` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `timestampSubmitted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `timestampDecided` timestamp NULL DEFAULT NULL, - `status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `ConciseAverageResults`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ConciseAverageResults` ( - `id` int(11) NOT NULL DEFAULT '0', - `average` int(11) NOT NULL DEFAULT '0', - `valueAndId` bigint(22) DEFAULT NULL, - `personId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `countryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `continentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `year` smallint(5) unsigned NOT NULL DEFAULT '0', - `month` smallint(5) unsigned NOT NULL DEFAULT '0', - `day` smallint(5) unsigned NOT NULL DEFAULT '0' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `ConciseSingleResults`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ConciseSingleResults` ( - `id` int(11) NOT NULL DEFAULT '0', - `best` int(11) NOT NULL DEFAULT '0', - `valueAndId` bigint(22) DEFAULT NULL, - `personId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `countryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `continentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `year` smallint(5) unsigned NOT NULL DEFAULT '0', - `month` smallint(5) unsigned NOT NULL DEFAULT '0', - `day` smallint(5) unsigned NOT NULL DEFAULT '0' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `Continents`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Continents` ( - `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `recordName` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `latitude` int(11) NOT NULL DEFAULT '0', - `longitude` int(11) NOT NULL DEFAULT '0', - `zoom` tinyint(4) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `Countries`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Countries` ( - `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `continentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `iso2` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `iso2` (`iso2`), - KEY `fk_continents` (`continentId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `Events`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Events` ( - `id` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `name` varchar(54) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `rank` int(11) NOT NULL DEFAULT '0', - `format` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `cellName` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci PACK_KEYS=0; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `Formats`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Formats` ( - `id` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `sort_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `sort_by_second` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `expected_solve_count` int(11) NOT NULL, - `trim_fastest_n` int(11) NOT NULL, - `trim_slowest_n` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `InboxPersons`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `InboxPersons` ( - `id` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `wcaId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `countryId` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `gender` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '', - `dob` date NOT NULL, - `competitionId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - UNIQUE KEY `index_InboxPersons_on_competitionId_and_id` (`competitionId`,`id`), - KEY `InboxPersons_fk_country` (`countryId`), - KEY `InboxPersons_id` (`wcaId`), - KEY `InboxPersons_name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `InboxResults`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `InboxResults` ( - `personId` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `pos` smallint(6) NOT NULL DEFAULT '0', - `competitionId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `roundTypeId` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `formatId` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `value1` int(11) NOT NULL DEFAULT '0', - `value2` int(11) NOT NULL DEFAULT '0', - `value3` int(11) NOT NULL DEFAULT '0', - `value4` int(11) NOT NULL DEFAULT '0', - `value5` int(11) NOT NULL DEFAULT '0', - `best` int(11) NOT NULL DEFAULT '0', - `average` int(11) NOT NULL DEFAULT '0', - `id` bigint(20) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`id`), - KEY `InboxResults_fk_tournament` (`competitionId`), - KEY `InboxResults_fk_event` (`eventId`), - KEY `InboxResults_fk_format` (`formatId`), - KEY `InboxResults_fk_round` (`roundTypeId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci PACK_KEYS=0; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `Persons`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Persons` ( - `id` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `subId` tinyint(6) NOT NULL DEFAULT '1', - `name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `countryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `gender` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '', - `year` smallint(6) NOT NULL DEFAULT '0', - `month` tinyint(4) NOT NULL DEFAULT '0', - `day` tinyint(4) NOT NULL DEFAULT '0', - `comments` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `rails_id` int(11) NOT NULL AUTO_INCREMENT, - `incorrect_wca_id_claim_count` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`rails_id`), - UNIQUE KEY `index_Persons_on_id_and_subId` (`id`,`subId`), - KEY `Persons_fk_country` (`countryId`), - KEY `Persons_id` (`id`), - KEY `Persons_name` (`name`), - FULLTEXT KEY `index_Persons_on_name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `RanksAverage`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `RanksAverage` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `personId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `best` int(11) NOT NULL DEFAULT '0', - `worldRank` int(11) NOT NULL DEFAULT '0', - `continentRank` int(11) NOT NULL DEFAULT '0', - `countryRank` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `fk_persons` (`personId`), - KEY `fk_events` (`eventId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `RanksSingle`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `RanksSingle` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `personId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `best` int(11) NOT NULL DEFAULT '0', - `worldRank` int(11) NOT NULL DEFAULT '0', - `continentRank` int(11) NOT NULL DEFAULT '0', - `countryRank` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `fk_persons` (`personId`), - KEY `fk_events` (`eventId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `Results`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Results` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `pos` smallint(6) NOT NULL DEFAULT '0', - `personId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `personName` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `countryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `competitionId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `roundTypeId` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `formatId` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `value1` int(11) NOT NULL DEFAULT '0', - `value2` int(11) NOT NULL DEFAULT '0', - `value3` int(11) NOT NULL DEFAULT '0', - `value4` int(11) NOT NULL DEFAULT '0', - `value5` int(11) NOT NULL DEFAULT '0', - `best` int(11) NOT NULL DEFAULT '0', - `average` int(11) NOT NULL DEFAULT '0', - `regionalSingleRecord` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `regionalAverageRecord` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - KEY `Results_fk_tournament` (`competitionId`), - KEY `Results_fk_event` (`eventId`), - KEY `Results_fk_format` (`formatId`), - KEY `Results_fk_round` (`roundTypeId`), - KEY `Results_eventAndAverage` (`eventId`,`average`), - KEY `Results_eventAndBest` (`eventId`,`best`), - KEY `Results_regionalAverageRecordCheckSpeedup` (`eventId`,`competitionId`,`roundTypeId`,`countryId`,`average`), - KEY `Results_regionalSingleRecordCheckSpeedup` (`eventId`,`competitionId`,`roundTypeId`,`countryId`,`best`), - KEY `Results_fk_competitor` (`personId`), - KEY `index_Results_on_competitionId_and_updated_at` (`competitionId`,`updated_at`), - KEY `_tmp_index_Results_on_countryId` (`countryId`), - KEY `index_Results_on_eventId_and_value1` (`eventId`,`value1`), - KEY `index_Results_on_eventId_and_value2` (`eventId`,`value2`), - KEY `index_Results_on_eventId_and_value3` (`eventId`,`value3`), - KEY `index_Results_on_eventId_and_value4` (`eventId`,`value4`), - KEY `index_Results_on_eventId_and_value5` (`eventId`,`value5`), - KEY `index_Results_on_regionalSingleRecord_and_eventId` (`regionalSingleRecord`,`eventId`), - KEY `index_Results_on_regionalAverageRecord_and_eventId` (`regionalAverageRecord`,`eventId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci PACK_KEYS=1; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `RoundTypes`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `RoundTypes` ( - `id` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `rank` int(11) NOT NULL DEFAULT '0', - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `cellName` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `final` tinyint(1) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `Scrambles`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Scrambles` ( - `scrambleId` int(10) unsigned NOT NULL AUTO_INCREMENT, - `competitionId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `roundTypeId` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `groupId` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `isExtra` tinyint(1) NOT NULL, - `scrambleNum` int(11) NOT NULL, - `scramble` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - PRIMARY KEY (`scrambleId`), - KEY `competitionId` (`competitionId`,`eventId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `active_storage_attachments`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `active_storage_attachments` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, + `id` bigint NOT NULL AUTO_INCREMENT, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `record_type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `record_id` bigint(20) NOT NULL, - `blob_id` bigint(20) NOT NULL, + `record_id` bigint NOT NULL, + `blob_id` bigint NOT NULL, `created_at` datetime NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_active_storage_attachments_uniqueness` (`record_type`,`record_id`,`name`,`blob_id`), @@ -377,25 +29,38 @@ CREATE TABLE `active_storage_attachments` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `active_storage_blobs`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `active_storage_blobs` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, + `id` bigint NOT NULL AUTO_INCREMENT, `key` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `filename` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `content_type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `metadata` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `byte_size` bigint(20) NOT NULL, - `checksum` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `byte_size` bigint NOT NULL, + `checksum` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` datetime NOT NULL, + `service_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_active_storage_blobs_on_key` (`key`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `active_storage_variant_records`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `active_storage_variant_records` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `blob_id` bigint NOT NULL, + `variation_digest` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `index_active_storage_variant_records_uniqueness` (`blob_id`,`variation_digest`), + CONSTRAINT `fk_rails_993965df05` FOREIGN KEY (`blob_id`) REFERENCES `active_storage_blobs` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `ar_internal_metadata`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `ar_internal_metadata` ( - `key` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, + `key` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL, `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, @@ -404,95 +69,95 @@ CREATE TABLE `ar_internal_metadata` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `archive_phpbb3_forums`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `archive_phpbb3_forums` ( - `forum_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `parent_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `left_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `right_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `forum_parents` mediumtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `forum_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_desc` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `forum_desc_bitfield` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_desc_options` int(11) unsigned NOT NULL DEFAULT '7', - `forum_desc_uid` varchar(8) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_link` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_password` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_style` mediumint(8) unsigned NOT NULL DEFAULT '0', - `forum_image` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_rules` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `forum_rules_link` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_rules_bitfield` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_rules_options` int(11) unsigned NOT NULL DEFAULT '7', - `forum_rules_uid` varchar(8) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_topics_per_page` tinyint(4) NOT NULL DEFAULT '0', - `forum_type` tinyint(4) NOT NULL DEFAULT '0', - `forum_status` tinyint(4) NOT NULL DEFAULT '0', - `forum_last_post_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `forum_last_poster_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `forum_last_post_subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_last_post_time` int(11) unsigned NOT NULL DEFAULT '0', - `forum_last_poster_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_last_poster_colour` varchar(6) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `forum_flags` tinyint(4) NOT NULL DEFAULT '32', - `display_on_index` tinyint(1) unsigned NOT NULL DEFAULT '1', - `enable_indexing` tinyint(1) unsigned NOT NULL DEFAULT '1', - `enable_icons` tinyint(1) unsigned NOT NULL DEFAULT '1', - `enable_prune` tinyint(1) unsigned NOT NULL DEFAULT '0', - `prune_next` int(11) unsigned NOT NULL DEFAULT '0', - `prune_days` mediumint(8) unsigned NOT NULL DEFAULT '0', - `prune_viewed` mediumint(8) unsigned NOT NULL DEFAULT '0', - `prune_freq` mediumint(8) unsigned NOT NULL DEFAULT '0', - `display_subforum_list` tinyint(1) unsigned NOT NULL DEFAULT '1', - `forum_options` int(20) unsigned NOT NULL DEFAULT '0', - `forum_posts_approved` mediumint(8) unsigned NOT NULL DEFAULT '0', - `forum_posts_unapproved` mediumint(8) unsigned NOT NULL DEFAULT '0', - `forum_posts_softdeleted` mediumint(8) unsigned NOT NULL DEFAULT '0', - `forum_topics_approved` mediumint(8) unsigned NOT NULL DEFAULT '0', - `forum_topics_unapproved` mediumint(8) unsigned NOT NULL DEFAULT '0', - `forum_topics_softdeleted` mediumint(8) unsigned NOT NULL DEFAULT '0', - `enable_shadow_prune` tinyint(1) unsigned NOT NULL DEFAULT '0', - `prune_shadow_days` mediumint(8) unsigned NOT NULL DEFAULT '7', - `prune_shadow_freq` mediumint(8) unsigned NOT NULL DEFAULT '1', - `prune_shadow_next` int(11) NOT NULL DEFAULT '0', + `forum_id` mediumint unsigned NOT NULL AUTO_INCREMENT, + `parent_id` mediumint unsigned NOT NULL DEFAULT '0', + `left_id` mediumint unsigned NOT NULL DEFAULT '0', + `right_id` mediumint unsigned NOT NULL DEFAULT '0', + `forum_parents` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, + `forum_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_desc` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, + `forum_desc_bitfield` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_desc_options` int unsigned NOT NULL DEFAULT '7', + `forum_desc_uid` varchar(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_link` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_password` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_style` mediumint unsigned NOT NULL DEFAULT '0', + `forum_image` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_rules` text CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, + `forum_rules_link` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_rules_bitfield` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_rules_options` int unsigned NOT NULL DEFAULT '7', + `forum_rules_uid` varchar(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_topics_per_page` tinyint NOT NULL DEFAULT '0', + `forum_type` tinyint NOT NULL DEFAULT '0', + `forum_status` tinyint NOT NULL DEFAULT '0', + `forum_last_post_id` mediumint unsigned NOT NULL DEFAULT '0', + `forum_last_poster_id` mediumint unsigned NOT NULL DEFAULT '0', + `forum_last_post_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_last_post_time` int unsigned NOT NULL DEFAULT '0', + `forum_last_poster_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_last_poster_colour` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `forum_flags` tinyint NOT NULL DEFAULT '32', + `display_on_index` tinyint unsigned NOT NULL DEFAULT '1', + `enable_indexing` tinyint unsigned NOT NULL DEFAULT '1', + `enable_icons` tinyint unsigned NOT NULL DEFAULT '1', + `enable_prune` tinyint unsigned NOT NULL DEFAULT '0', + `prune_next` int unsigned NOT NULL DEFAULT '0', + `prune_days` mediumint unsigned NOT NULL DEFAULT '0', + `prune_viewed` mediumint unsigned NOT NULL DEFAULT '0', + `prune_freq` mediumint unsigned NOT NULL DEFAULT '0', + `display_subforum_list` tinyint unsigned NOT NULL DEFAULT '1', + `forum_options` int unsigned NOT NULL DEFAULT '0', + `forum_posts_approved` mediumint unsigned NOT NULL DEFAULT '0', + `forum_posts_unapproved` mediumint unsigned NOT NULL DEFAULT '0', + `forum_posts_softdeleted` mediumint unsigned NOT NULL DEFAULT '0', + `forum_topics_approved` mediumint unsigned NOT NULL DEFAULT '0', + `forum_topics_unapproved` mediumint unsigned NOT NULL DEFAULT '0', + `forum_topics_softdeleted` mediumint unsigned NOT NULL DEFAULT '0', + `enable_shadow_prune` tinyint unsigned NOT NULL DEFAULT '0', + `prune_shadow_days` mediumint unsigned NOT NULL DEFAULT '7', + `prune_shadow_freq` mediumint unsigned NOT NULL DEFAULT '1', + `prune_shadow_next` int NOT NULL DEFAULT '0', PRIMARY KEY (`forum_id`), KEY `left_right_id` (`left_id`,`right_id`), KEY `forum_lastpost_id` (`forum_last_post_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `archive_phpbb3_posts`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `archive_phpbb3_posts` ( - `post_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `topic_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `forum_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `poster_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `icon_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `poster_ip` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `post_time` int(11) unsigned NOT NULL DEFAULT '0', - `post_reported` tinyint(1) unsigned NOT NULL DEFAULT '0', - `enable_bbcode` tinyint(1) unsigned NOT NULL DEFAULT '1', - `enable_smilies` tinyint(1) unsigned NOT NULL DEFAULT '1', - `enable_magic_url` tinyint(1) unsigned NOT NULL DEFAULT '1', - `enable_sig` tinyint(1) unsigned NOT NULL DEFAULT '1', - `post_username` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `post_subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `post_text` mediumtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, - `post_checksum` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `post_attachment` tinyint(1) unsigned NOT NULL DEFAULT '0', - `bbcode_bitfield` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `bbcode_uid` varchar(8) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `post_postcount` tinyint(1) unsigned NOT NULL DEFAULT '1', - `post_edit_time` int(11) unsigned NOT NULL DEFAULT '0', - `post_edit_reason` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `post_edit_user` mediumint(8) unsigned NOT NULL DEFAULT '0', - `post_edit_count` smallint(4) unsigned NOT NULL DEFAULT '0', - `post_edit_locked` tinyint(1) unsigned NOT NULL DEFAULT '0', - `post_visibility` tinyint(3) NOT NULL DEFAULT '0', - `post_delete_time` int(11) unsigned NOT NULL DEFAULT '0', - `post_delete_reason` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `post_delete_user` mediumint(8) unsigned NOT NULL DEFAULT '0', + `post_id` mediumint unsigned NOT NULL AUTO_INCREMENT, + `topic_id` mediumint unsigned NOT NULL DEFAULT '0', + `forum_id` mediumint unsigned NOT NULL DEFAULT '0', + `poster_id` mediumint unsigned NOT NULL DEFAULT '0', + `icon_id` mediumint unsigned NOT NULL DEFAULT '0', + `poster_ip` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `post_time` int unsigned NOT NULL DEFAULT '0', + `post_reported` tinyint unsigned NOT NULL DEFAULT '0', + `enable_bbcode` tinyint unsigned NOT NULL DEFAULT '1', + `enable_smilies` tinyint unsigned NOT NULL DEFAULT '1', + `enable_magic_url` tinyint unsigned NOT NULL DEFAULT '1', + `enable_sig` tinyint unsigned NOT NULL DEFAULT '1', + `post_username` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `post_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '', + `post_text` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL, + `post_checksum` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `post_attachment` tinyint unsigned NOT NULL DEFAULT '0', + `bbcode_bitfield` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `bbcode_uid` varchar(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `post_postcount` tinyint unsigned NOT NULL DEFAULT '1', + `post_edit_time` int unsigned NOT NULL DEFAULT '0', + `post_edit_reason` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `post_edit_user` mediumint unsigned NOT NULL DEFAULT '0', + `post_edit_count` smallint unsigned NOT NULL DEFAULT '0', + `post_edit_locked` tinyint unsigned NOT NULL DEFAULT '0', + `post_visibility` tinyint NOT NULL DEFAULT '0', + `post_delete_time` int unsigned NOT NULL DEFAULT '0', + `post_delete_reason` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `post_delete_user` mediumint unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`post_id`), KEY `forum_id` (`forum_id`), KEY `topic_id` (`topic_id`), @@ -503,51 +168,51 @@ CREATE TABLE `archive_phpbb3_posts` ( KEY `post_visibility` (`post_visibility`), FULLTEXT KEY `post_subject` (`post_subject`), FULLTEXT KEY `post_content` (`post_text`,`post_subject`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `archive_phpbb3_topics`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `archive_phpbb3_topics` ( - `topic_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `forum_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `icon_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `topic_attachment` tinyint(1) unsigned NOT NULL DEFAULT '0', - `topic_reported` tinyint(1) unsigned NOT NULL DEFAULT '0', - `topic_title` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `topic_poster` mediumint(8) unsigned NOT NULL DEFAULT '0', - `topic_time` int(11) unsigned NOT NULL DEFAULT '0', - `topic_time_limit` int(11) unsigned NOT NULL DEFAULT '0', - `topic_views` mediumint(8) unsigned NOT NULL DEFAULT '0', - `topic_status` tinyint(3) NOT NULL DEFAULT '0', - `topic_type` tinyint(3) NOT NULL DEFAULT '0', - `topic_first_post_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `topic_first_poster_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', - `topic_first_poster_colour` varchar(6) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `topic_last_post_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `topic_last_poster_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `topic_last_poster_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `topic_last_poster_colour` varchar(6) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `topic_last_post_subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `topic_last_post_time` int(11) unsigned NOT NULL DEFAULT '0', - `topic_last_view_time` int(11) unsigned NOT NULL DEFAULT '0', - `topic_moved_id` mediumint(8) unsigned NOT NULL DEFAULT '0', - `topic_bumped` tinyint(1) unsigned NOT NULL DEFAULT '0', - `topic_bumper` mediumint(8) unsigned NOT NULL DEFAULT '0', - `poll_title` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `poll_start` int(11) unsigned NOT NULL DEFAULT '0', - `poll_length` int(11) unsigned NOT NULL DEFAULT '0', - `poll_max_options` tinyint(4) NOT NULL DEFAULT '1', - `poll_last_vote` int(11) unsigned NOT NULL DEFAULT '0', - `poll_vote_change` tinyint(1) unsigned NOT NULL DEFAULT '0', + `topic_id` mediumint unsigned NOT NULL AUTO_INCREMENT, + `forum_id` mediumint unsigned NOT NULL DEFAULT '0', + `icon_id` mediumint unsigned NOT NULL DEFAULT '0', + `topic_attachment` tinyint unsigned NOT NULL DEFAULT '0', + `topic_reported` tinyint unsigned NOT NULL DEFAULT '0', + `topic_title` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '', + `topic_poster` mediumint unsigned NOT NULL DEFAULT '0', + `topic_time` int unsigned NOT NULL DEFAULT '0', + `topic_time_limit` int unsigned NOT NULL DEFAULT '0', + `topic_views` mediumint unsigned NOT NULL DEFAULT '0', + `topic_status` tinyint NOT NULL DEFAULT '0', + `topic_type` tinyint NOT NULL DEFAULT '0', + `topic_first_post_id` mediumint unsigned NOT NULL DEFAULT '0', + `topic_first_poster_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL DEFAULT '', + `topic_first_poster_colour` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `topic_last_post_id` mediumint unsigned NOT NULL DEFAULT '0', + `topic_last_poster_id` mediumint unsigned NOT NULL DEFAULT '0', + `topic_last_poster_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `topic_last_poster_colour` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `topic_last_post_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `topic_last_post_time` int unsigned NOT NULL DEFAULT '0', + `topic_last_view_time` int unsigned NOT NULL DEFAULT '0', + `topic_moved_id` mediumint unsigned NOT NULL DEFAULT '0', + `topic_bumped` tinyint unsigned NOT NULL DEFAULT '0', + `topic_bumper` mediumint unsigned NOT NULL DEFAULT '0', + `poll_title` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `poll_start` int unsigned NOT NULL DEFAULT '0', + `poll_length` int unsigned NOT NULL DEFAULT '0', + `poll_max_options` tinyint NOT NULL DEFAULT '1', + `poll_last_vote` int unsigned NOT NULL DEFAULT '0', + `poll_vote_change` tinyint unsigned NOT NULL DEFAULT '0', `poll_vote_name` tinyint(1) NOT NULL DEFAULT '0', - `topic_visibility` tinyint(3) NOT NULL DEFAULT '0', - `topic_delete_time` int(11) unsigned NOT NULL DEFAULT '0', - `topic_delete_reason` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `topic_delete_user` mediumint(8) unsigned NOT NULL DEFAULT '0', - `topic_posts_approved` mediumint(8) unsigned NOT NULL DEFAULT '0', - `topic_posts_unapproved` mediumint(8) unsigned NOT NULL DEFAULT '0', - `topic_posts_softdeleted` mediumint(8) unsigned NOT NULL DEFAULT '0', + `topic_visibility` tinyint NOT NULL DEFAULT '0', + `topic_delete_time` int unsigned NOT NULL DEFAULT '0', + `topic_delete_reason` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `topic_delete_user` mediumint unsigned NOT NULL DEFAULT '0', + `topic_posts_approved` mediumint unsigned NOT NULL DEFAULT '0', + `topic_posts_unapproved` mediumint unsigned NOT NULL DEFAULT '0', + `topic_posts_softdeleted` mediumint unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`topic_id`), KEY `forum_id` (`forum_id`), KEY `forum_id_type` (`forum_id`,`topic_type`), @@ -555,106 +220,106 @@ CREATE TABLE `archive_phpbb3_topics` ( KEY `fid_time_moved` (`forum_id`,`topic_last_post_time`,`topic_moved_id`), KEY `topic_visibility` (`topic_visibility`), KEY `forum_vis_last` (`forum_id`,`topic_visibility`,`topic_last_post_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `archive_phpbb3_users`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `archive_phpbb3_users` ( - `user_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `user_type` tinyint(2) NOT NULL DEFAULT '0', - `group_id` mediumint(8) unsigned NOT NULL DEFAULT '3', - `user_permissions` mediumtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `user_perm_from` mediumint(8) unsigned NOT NULL DEFAULT '0', - `user_ip` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_regdate` int(11) unsigned NOT NULL DEFAULT '0', - `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `username_clean` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_password` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_passchg` int(11) unsigned NOT NULL DEFAULT '0', - `user_email` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_email_hash` bigint(20) NOT NULL DEFAULT '0', - `user_birthday` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_lastvisit` int(11) unsigned NOT NULL DEFAULT '0', - `user_lastmark` int(11) unsigned NOT NULL DEFAULT '0', - `user_lastpost_time` int(11) unsigned NOT NULL DEFAULT '0', - `user_lastpage` varchar(200) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_last_confirm_key` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_last_search` int(11) unsigned NOT NULL DEFAULT '0', - `user_warnings` tinyint(4) NOT NULL DEFAULT '0', - `user_last_warning` int(11) unsigned NOT NULL DEFAULT '0', - `user_login_attempts` tinyint(4) NOT NULL DEFAULT '0', - `user_inactive_reason` tinyint(2) NOT NULL DEFAULT '0', - `user_inactive_time` int(11) unsigned NOT NULL DEFAULT '0', - `user_posts` mediumint(8) unsigned NOT NULL DEFAULT '0', - `user_lang` varchar(30) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_timezone` varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_dateformat` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'd M Y H:i', - `user_style` mediumint(8) unsigned NOT NULL DEFAULT '0', - `user_rank` mediumint(8) unsigned NOT NULL DEFAULT '0', - `user_colour` varchar(6) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_new_privmsg` int(4) NOT NULL DEFAULT '0', - `user_unread_privmsg` int(4) NOT NULL DEFAULT '0', - `user_last_privmsg` int(11) unsigned NOT NULL DEFAULT '0', - `user_message_rules` tinyint(1) unsigned NOT NULL DEFAULT '0', - `user_full_folder` int(11) NOT NULL DEFAULT '-3', - `user_emailtime` int(11) unsigned NOT NULL DEFAULT '0', - `user_topic_show_days` smallint(4) unsigned NOT NULL DEFAULT '0', - `user_topic_sortby_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 't', - `user_topic_sortby_dir` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'd', - `user_post_show_days` smallint(4) unsigned NOT NULL DEFAULT '0', - `user_post_sortby_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 't', - `user_post_sortby_dir` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'a', - `user_notify` tinyint(1) unsigned NOT NULL DEFAULT '0', - `user_notify_pm` tinyint(1) unsigned NOT NULL DEFAULT '1', - `user_notify_type` tinyint(4) NOT NULL DEFAULT '0', - `user_allow_pm` tinyint(1) unsigned NOT NULL DEFAULT '1', - `user_allow_viewonline` tinyint(1) unsigned NOT NULL DEFAULT '1', - `user_allow_viewemail` tinyint(1) unsigned NOT NULL DEFAULT '1', - `user_allow_massemail` tinyint(1) unsigned NOT NULL DEFAULT '1', - `user_options` int(11) unsigned NOT NULL DEFAULT '230271', - `user_avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_avatar_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_avatar_width` smallint(4) unsigned NOT NULL DEFAULT '0', - `user_avatar_height` smallint(4) unsigned NOT NULL DEFAULT '0', - `user_sig` mediumtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `user_sig_bbcode_uid` varchar(8) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_sig_bbcode_bitfield` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_jabber` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_actkey` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_newpasswd` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_form_salt` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `user_new` tinyint(1) unsigned NOT NULL DEFAULT '1', - `user_reminded` tinyint(4) NOT NULL DEFAULT '0', - `user_reminded_time` int(11) unsigned NOT NULL DEFAULT '0', + `user_id` mediumint unsigned NOT NULL AUTO_INCREMENT, + `user_type` tinyint NOT NULL DEFAULT '0', + `group_id` mediumint unsigned NOT NULL DEFAULT '3', + `user_permissions` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, + `user_perm_from` mediumint unsigned NOT NULL DEFAULT '0', + `user_ip` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_regdate` int unsigned NOT NULL DEFAULT '0', + `username` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `username_clean` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_password` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_passchg` int unsigned NOT NULL DEFAULT '0', + `user_email` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_email_hash` bigint NOT NULL DEFAULT '0', + `user_birthday` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_lastvisit` int unsigned NOT NULL DEFAULT '0', + `user_lastmark` int unsigned NOT NULL DEFAULT '0', + `user_lastpost_time` int unsigned NOT NULL DEFAULT '0', + `user_lastpage` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_last_confirm_key` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_last_search` int unsigned NOT NULL DEFAULT '0', + `user_warnings` tinyint NOT NULL DEFAULT '0', + `user_last_warning` int unsigned NOT NULL DEFAULT '0', + `user_login_attempts` tinyint NOT NULL DEFAULT '0', + `user_inactive_reason` tinyint NOT NULL DEFAULT '0', + `user_inactive_time` int unsigned NOT NULL DEFAULT '0', + `user_posts` mediumint unsigned NOT NULL DEFAULT '0', + `user_lang` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_timezone` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_dateformat` varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT 'd M Y H:i', + `user_style` mediumint unsigned NOT NULL DEFAULT '0', + `user_rank` mediumint unsigned NOT NULL DEFAULT '0', + `user_colour` varchar(6) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_new_privmsg` int NOT NULL DEFAULT '0', + `user_unread_privmsg` int NOT NULL DEFAULT '0', + `user_last_privmsg` int unsigned NOT NULL DEFAULT '0', + `user_message_rules` tinyint unsigned NOT NULL DEFAULT '0', + `user_full_folder` int NOT NULL DEFAULT '-3', + `user_emailtime` int unsigned NOT NULL DEFAULT '0', + `user_topic_show_days` smallint unsigned NOT NULL DEFAULT '0', + `user_topic_sortby_type` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT 't', + `user_topic_sortby_dir` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT 'd', + `user_post_show_days` smallint unsigned NOT NULL DEFAULT '0', + `user_post_sortby_type` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT 't', + `user_post_sortby_dir` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT 'a', + `user_notify` tinyint unsigned NOT NULL DEFAULT '0', + `user_notify_pm` tinyint unsigned NOT NULL DEFAULT '1', + `user_notify_type` tinyint NOT NULL DEFAULT '0', + `user_allow_pm` tinyint unsigned NOT NULL DEFAULT '1', + `user_allow_viewonline` tinyint unsigned NOT NULL DEFAULT '1', + `user_allow_viewemail` tinyint unsigned NOT NULL DEFAULT '1', + `user_allow_massemail` tinyint unsigned NOT NULL DEFAULT '1', + `user_options` int unsigned NOT NULL DEFAULT '230271', + `user_avatar` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_avatar_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_avatar_width` smallint unsigned NOT NULL DEFAULT '0', + `user_avatar_height` smallint unsigned NOT NULL DEFAULT '0', + `user_sig` mediumtext CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL, + `user_sig_bbcode_uid` varchar(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_sig_bbcode_bitfield` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_jabber` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_actkey` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_newpasswd` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_form_salt` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL DEFAULT '', + `user_new` tinyint unsigned NOT NULL DEFAULT '1', + `user_reminded` tinyint NOT NULL DEFAULT '0', + `user_reminded_time` int unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`user_id`), UNIQUE KEY `username_clean` (`username_clean`), KEY `user_birthday` (`user_birthday`), KEY `user_email_hash` (`user_email_hash`), KEY `user_type` (`user_type`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `archive_registrations`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `archive_registrations` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `competitionId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `personId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `countryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `gender` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `birthYear` smallint(6) unsigned NOT NULL DEFAULT '0', - `birthMonth` tinyint(4) unsigned NOT NULL DEFAULT '0', - `birthDay` tinyint(4) unsigned NOT NULL DEFAULT '0', + `birthYear` smallint unsigned NOT NULL DEFAULT '0', + `birthMonth` tinyint unsigned NOT NULL DEFAULT '0', + `birthDay` tinyint unsigned NOT NULL DEFAULT '0', `email` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `guests_old` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `comments` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `ip` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `user_id` int(11) DEFAULT NULL, + `user_id` int DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, - `guests` int(11) NOT NULL DEFAULT '0', + `guests` int NOT NULL DEFAULT '0', `accepted_at` datetime DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_registrations_on_competitionId_and_user_id` (`competitionId`,`user_id`) @@ -662,12 +327,12 @@ CREATE TABLE `archive_registrations` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `assignments`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `assignments` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `registration_id` bigint(20) DEFAULT NULL, - `schedule_activity_id` bigint(20) DEFAULT NULL, - `station_number` int(11) DEFAULT NULL, + `id` bigint NOT NULL AUTO_INCREMENT, + `registration_id` bigint DEFAULT NULL, + `schedule_activity_id` bigint DEFAULT NULL, + `station_number` int DEFAULT NULL, `assignment_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), KEY `index_assignments_on_registration_id` (`registration_id`), @@ -676,21 +341,32 @@ CREATE TABLE `assignments` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `bookmarked_competitions`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `bookmarked_competitions` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, + `id` bigint NOT NULL AUTO_INCREMENT, `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `user_id` int(11) NOT NULL, + `user_id` int NOT NULL, PRIMARY KEY (`id`), KEY `index_bookmarked_competitions_on_competition_id` (`competition_id`), KEY `index_bookmarked_competitions_on_user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `cached_results`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `cached_results` ( + `key_params` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `payload` json DEFAULT NULL, + `created_at` datetime(6) NOT NULL, + `updated_at` datetime(6) NOT NULL, + PRIMARY KEY (`key_params`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `championships`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `championships` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int NOT NULL AUTO_INCREMENT, `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `championship_type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), @@ -700,118 +376,278 @@ CREATE TABLE `championships` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `competition_delegates`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `competition_delegates` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int NOT NULL AUTO_INCREMENT, `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `delegate_id` int(11) DEFAULT NULL, + `delegate_id` int DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, - `receive_registration_emails` tinyint(1) NOT NULL DEFAULT '1', + `receive_registration_emails` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `index_competition_delegates_on_competition_id_and_delegate_id` (`competition_id`,`delegate_id`), KEY `index_competition_delegates_on_competition_id` (`competition_id`), KEY `index_competition_delegates_on_delegate_id` (`delegate_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `competition_events`; +DROP TABLE IF EXISTS `competition_events`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `competition_events` ( + `id` int NOT NULL AUTO_INCREMENT, + `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `event_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `fee_lowest_denomination` int NOT NULL DEFAULT '0', + `qualification` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + PRIMARY KEY (`id`), + UNIQUE KEY `index_competition_events_on_competition_id_and_event_id` (`competition_id`,`event_id`), + KEY `fk_rails_ba6cfdafb1` (`event_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `competition_organizers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `competition_organizers` ( + `id` int NOT NULL AUTO_INCREMENT, + `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `organizer_id` int DEFAULT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + `receive_registration_emails` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `idx_competition_organizers_on_competition_id_and_organizer_id` (`competition_id`,`organizer_id`), + KEY `index_competition_organizers_on_competition_id` (`competition_id`), + KEY `index_competition_organizers_on_organizer_id` (`organizer_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `competition_series`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `competition_series` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `wcif_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `short_name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `competition_tabs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `competition_tabs` ( + `id` int NOT NULL AUTO_INCREMENT, + `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `display_order` int DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `index_competition_tabs_on_display_order_and_competition_id` (`display_order`,`competition_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `competition_venues`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `competition_venues` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `wcif_id` int NOT NULL, + `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `latitude_microdegrees` int NOT NULL, + `longitude_microdegrees` int NOT NULL, + `timezone_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + `country_iso2` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `index_competition_venues_on_competition_id_and_wcif_id` (`competition_id`,`wcif_id`), + KEY `index_competition_venues_on_competition_id` (`competition_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `Competitions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `Competitions` ( + `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `cityName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `countryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `information` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `year` smallint unsigned NOT NULL DEFAULT '0', + `month` smallint unsigned NOT NULL DEFAULT '0', + `day` smallint unsigned NOT NULL DEFAULT '0', + `endMonth` smallint unsigned NOT NULL DEFAULT '0', + `endDay` smallint unsigned NOT NULL DEFAULT '0', + `venue` varchar(240) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `venueAddress` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `venueDetails` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `external_website` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `cellName` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `showAtAll` tinyint(1) NOT NULL DEFAULT '0', + `latitude` int DEFAULT NULL, + `longitude` int DEFAULT NULL, + `contact` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `registration_open` datetime DEFAULT NULL, + `registration_close` datetime DEFAULT NULL, + `use_wca_registration` tinyint(1) NOT NULL DEFAULT '1', + `guests_enabled` tinyint(1) NOT NULL DEFAULT '1', + `results_posted_at` datetime DEFAULT NULL, + `results_nag_sent_at` datetime DEFAULT NULL, + `generate_website` tinyint(1) DEFAULT NULL, + `announced_at` datetime DEFAULT NULL, + `base_entry_fee_lowest_denomination` int DEFAULT NULL, + `currency_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'USD', + `endYear` smallint NOT NULL DEFAULT '0', + `connected_stripe_account_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `start_date` date DEFAULT NULL, + `end_date` date DEFAULT NULL, + `enable_donations` tinyint(1) DEFAULT NULL, + `competitor_limit_enabled` tinyint(1) DEFAULT NULL, + `competitor_limit` int DEFAULT NULL, + `competitor_limit_reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `extra_registration_requirements` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `on_the_spot_registration` tinyint(1) DEFAULT NULL, + `on_the_spot_entry_fee_lowest_denomination` int DEFAULT NULL, + `refund_policy_percent` int DEFAULT NULL, + `refund_policy_limit_date` datetime DEFAULT NULL, + `guests_entry_fee_lowest_denomination` int DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + `updated_at` datetime DEFAULT NULL, + `results_submitted_at` datetime DEFAULT NULL, + `early_puzzle_submission` tinyint(1) DEFAULT NULL, + `early_puzzle_submission_reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `qualification_results` tinyint(1) DEFAULT NULL, + `qualification_results_reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `name_reason` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `external_registration_page` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `confirmed_at` datetime DEFAULT NULL, + `event_restrictions` tinyint(1) DEFAULT NULL, + `event_restrictions_reason` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `registration_reminder_sent_at` datetime DEFAULT NULL, + `announced_by` int DEFAULT NULL, + `results_posted_by` int DEFAULT NULL, + `main_event_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `cancelled_at` datetime DEFAULT NULL, + `cancelled_by` int DEFAULT NULL, + `waiting_list_deadline_date` datetime DEFAULT NULL, + `event_change_deadline_date` datetime DEFAULT NULL, + `guest_entry_status` int NOT NULL DEFAULT '0', + `allow_registration_edits` tinyint(1) NOT NULL DEFAULT '0', + `allow_registration_self_delete_after_acceptance` tinyint(1) NOT NULL DEFAULT '0', + `competition_series_id` int DEFAULT NULL, + `use_wca_live_for_scoretaking` tinyint(1) NOT NULL DEFAULT '0', + `allow_registration_without_qualification` tinyint(1) DEFAULT '0', + `guests_per_registration_limit` int DEFAULT NULL, + `events_per_registration_limit` int DEFAULT NULL, + `force_comment_in_registration` tinyint(1) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `year_month_day` (`year`,`month`,`day`), + KEY `index_Competitions_on_countryId` (`countryId`), + KEY `index_Competitions_on_start_date` (`start_date`), + KEY `index_Competitions_on_end_date` (`end_date`), + KEY `index_Competitions_on_cancelled_at` (`cancelled_at`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `CompetitionsMedia`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `competition_events` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `event_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `fee_lowest_denomination` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - UNIQUE KEY `index_competition_events_on_competition_id_and_event_id` (`competition_id`,`event_id`), - KEY `fk_rails_ba6cfdafb1` (`event_id`) +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `CompetitionsMedia` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `competitionId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `type` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `text` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `uri` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `submitterName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `submitterComment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `submitterEmail` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `timestampSubmitted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `timestampDecided` timestamp NULL DEFAULT NULL, + `status` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `competition_organizers`; +DROP TABLE IF EXISTS `completed_jobs`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `competition_organizers` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `organizer_id` int(11) DEFAULT NULL, +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `completed_jobs` ( + `id` int NOT NULL AUTO_INCREMENT, + `priority` int NOT NULL DEFAULT '0', + `attempts` int NOT NULL DEFAULT '0', + `handler` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `run_at` datetime DEFAULT NULL, + `queue` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, - `receive_registration_emails` tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - UNIQUE KEY `idx_competition_organizers_on_competition_id_and_organizer_id` (`competition_id`,`organizer_id`), - KEY `index_competition_organizers_on_competition_id` (`competition_id`), - KEY `index_competition_organizers_on_organizer_id` (`organizer_id`) + `completed_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `competition_tabs`; +DROP TABLE IF EXISTS `ConciseAverageResults`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `competition_tabs` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `display_order` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `index_competition_tabs_on_display_order_and_competition_id` (`display_order`,`competition_id`) +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `ConciseAverageResults` ( + `id` int NOT NULL DEFAULT '0', + `average` int NOT NULL DEFAULT '0', + `valueAndId` bigint DEFAULT NULL, + `personId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `countryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `continentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `year` smallint unsigned NOT NULL DEFAULT '0', + `month` smallint unsigned NOT NULL DEFAULT '0', + `day` smallint unsigned NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `competition_trainee_delegates`; +DROP TABLE IF EXISTS `ConciseSingleResults`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `competition_trainee_delegates` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `competition_id` varchar(191) DEFAULT NULL, - `trainee_delegate_id` int(11) DEFAULT NULL, - `receive_registration_emails` tinyint(1) NOT NULL DEFAULT '1', - `created_at` datetime NOT NULL, - `updated_at` datetime NOT NULL, - PRIMARY KEY (`id`), - KEY `index_competition_trainee_delegates_on_competition_id` (`competition_id`), - KEY `index_competition_trainee_delegates_on_trainee_delegate_id` (`trainee_delegate_id`) +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `ConciseSingleResults` ( + `id` int NOT NULL DEFAULT '0', + `best` int NOT NULL DEFAULT '0', + `valueAndId` bigint DEFAULT NULL, + `personId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `countryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `continentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `year` smallint unsigned NOT NULL DEFAULT '0', + `month` smallint unsigned NOT NULL DEFAULT '0', + `day` smallint unsigned NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `competition_venues`; +DROP TABLE IF EXISTS `Continents`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `competition_venues` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `wcif_id` int(11) NOT NULL, - `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `latitude_microdegrees` int(11) NOT NULL, - `longitude_microdegrees` int(11) NOT NULL, - `timezone_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `created_at` datetime NOT NULL, - `updated_at` datetime NOT NULL, - `country_iso2` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `index_competition_venues_on_competition_id_and_wcif_id` (`competition_id`,`wcif_id`), - KEY `index_competition_venues_on_competition_id` (`competition_id`) +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `Continents` ( + `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `recordName` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `latitude` int NOT NULL DEFAULT '0', + `longitude` int NOT NULL DEFAULT '0', + `zoom` tinyint NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `completed_jobs`; +DROP TABLE IF EXISTS `Countries`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `completed_jobs` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `priority` int(11) NOT NULL DEFAULT '0', - `attempts` int(11) NOT NULL DEFAULT '0', - `handler` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `run_at` datetime DEFAULT NULL, - `queue` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `created_at` datetime NOT NULL, - `updated_at` datetime NOT NULL, - `completed_at` datetime DEFAULT NULL, - PRIMARY KEY (`id`) +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `Countries` ( + `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `continentId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `iso2` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `iso2` (`iso2`), + KEY `fk_continents` (`continentId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `country_bands`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `country_bands` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `number` int(11) NOT NULL, + `id` bigint NOT NULL AUTO_INCREMENT, + `number` int NOT NULL, `iso2` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_country_bands_on_iso2` (`iso2`), @@ -820,11 +656,11 @@ CREATE TABLE `country_bands` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `delayed_jobs`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `delayed_jobs` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `priority` int(11) NOT NULL DEFAULT '0', - `attempts` int(11) NOT NULL DEFAULT '0', + `id` int NOT NULL AUTO_INCREMENT, + `priority` int NOT NULL DEFAULT '0', + `attempts` int NOT NULL DEFAULT '0', `handler` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `last_error` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `run_at` datetime DEFAULT NULL, @@ -840,9 +676,9 @@ CREATE TABLE `delayed_jobs` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `delegate_reports`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `delegate_reports` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int NOT NULL AUTO_INCREMENT, `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `equipment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `venue` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, @@ -851,7 +687,7 @@ CREATE TABLE `delegate_reports` ( `incidents` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `remarks` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `discussion_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `posted_by_user_id` int(11) DEFAULT NULL, + `posted_by_user_id` int DEFAULT NULL, `posted_at` datetime DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, @@ -860,29 +696,98 @@ CREATE TABLE `delegate_reports` ( `wrc_incidents` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `wdc_feedback_requested` tinyint(1) NOT NULL DEFAULT '0', `wdc_incidents` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `wrc_primary_user_id` int(11) DEFAULT NULL, - `wrc_secondary_user_id` int(11) DEFAULT NULL, + `wrc_primary_user_id` int DEFAULT NULL, + `wrc_secondary_user_id` int DEFAULT NULL, + `reminder_sent_at` datetime DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_delegate_reports_on_competition_id` (`competition_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `eligible_country_iso2s_for_championship`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `eligible_country_iso2s_for_championship` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, + `id` bigint NOT NULL AUTO_INCREMENT, `championship_type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `eligible_country_iso2` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_eligible_iso2s_for_championship_on_type_and_country_iso2` (`championship_type`,`eligible_country_iso2`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `Events`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `Events` ( + `id` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `name` varchar(54) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `rank` int NOT NULL DEFAULT '0', + `format` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `cellName` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci PACK_KEYS=0; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `Formats`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `Formats` ( + `id` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `sort_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `sort_by_second` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `expected_solve_count` int NOT NULL, + `trim_fastest_n` int NOT NULL, + `trim_slowest_n` int NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `InboxPersons`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `InboxPersons` ( + `id` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `wcaId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `countryId` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `gender` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '', + `dob` date NOT NULL, + `competitionId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + UNIQUE KEY `index_InboxPersons_on_competitionId_and_id` (`competitionId`,`id`), + KEY `InboxPersons_fk_country` (`countryId`), + KEY `InboxPersons_id` (`wcaId`), + KEY `InboxPersons_name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `InboxResults`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `InboxResults` ( + `personId` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `pos` smallint NOT NULL DEFAULT '0', + `competitionId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `roundTypeId` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `formatId` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `value1` int NOT NULL DEFAULT '0', + `value2` int NOT NULL DEFAULT '0', + `value3` int NOT NULL DEFAULT '0', + `value4` int NOT NULL DEFAULT '0', + `value5` int NOT NULL DEFAULT '0', + `best` int NOT NULL DEFAULT '0', + `average` int NOT NULL DEFAULT '0', + `id` bigint NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `InboxResults_fk_tournament` (`competitionId`), + KEY `InboxResults_fk_event` (`eventId`), + KEY `InboxResults_fk_format` (`formatId`), + KEY `InboxResults_fk_round` (`roundTypeId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci PACK_KEYS=0; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `incident_competitions`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `incident_competitions` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `incident_id` bigint(20) NOT NULL, + `id` bigint NOT NULL AUTO_INCREMENT, + `incident_id` bigint NOT NULL, `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `comments` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), @@ -892,10 +797,10 @@ CREATE TABLE `incident_competitions` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `incident_tags`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `incident_tags` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `incident_id` bigint(20) NOT NULL, + `id` bigint NOT NULL AUTO_INCREMENT, + `incident_id` bigint NOT NULL, `tag` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_incident_tags_on_incident_id_and_tag` (`incident_id`,`tag`), @@ -905,9 +810,9 @@ CREATE TABLE `incident_tags` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `incidents`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `incidents` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, + `id` bigint NOT NULL AUTO_INCREMENT, `title` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `private_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `private_wrc_decision` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, @@ -922,7 +827,7 @@ CREATE TABLE `incidents` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `linkings`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `linkings` ( `wca_id` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `wca_ids` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, @@ -931,13 +836,13 @@ CREATE TABLE `linkings` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `locations`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `locations` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `user_id` int(11) NOT NULL, - `latitude_microdegrees` int(11) DEFAULT NULL, - `longitude_microdegrees` int(11) DEFAULT NULL, - `notification_radius_km` int(11) DEFAULT NULL, + `id` bigint NOT NULL AUTO_INCREMENT, + `user_id` int NOT NULL, + `latitude_microdegrees` int DEFAULT NULL, + `longitude_microdegrees` int DEFAULT NULL, + `notification_radius_km` int DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`id`) @@ -945,13 +850,13 @@ CREATE TABLE `locations` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `oauth_access_grants`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `oauth_access_grants` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `resource_owner_id` int(11) NOT NULL, - `application_id` int(11) NOT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `resource_owner_id` int NOT NULL, + `application_id` int NOT NULL, `token` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `expires_in` int(11) NOT NULL, + `expires_in` int NOT NULL, `redirect_uri` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `created_at` datetime NOT NULL, `revoked_at` datetime DEFAULT NULL, @@ -962,14 +867,14 @@ CREATE TABLE `oauth_access_grants` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `oauth_access_tokens`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `oauth_access_tokens` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `resource_owner_id` int(11) DEFAULT NULL, - `application_id` int(11) DEFAULT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `resource_owner_id` int DEFAULT NULL, + `application_id` int DEFAULT NULL, `token` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `refresh_token` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `expires_in` int(11) DEFAULT NULL, + `expires_in` int DEFAULT NULL, `revoked_at` datetime DEFAULT NULL, `created_at` datetime NOT NULL, `scopes` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -981,9 +886,9 @@ CREATE TABLE `oauth_access_tokens` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `oauth_applications`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `oauth_applications` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `uid` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, @@ -991,7 +896,7 @@ CREATE TABLE `oauth_applications` ( `scopes` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `created_at` datetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL, - `owner_id` int(11) DEFAULT NULL, + `owner_id` int DEFAULT NULL, `owner_type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `dangerously_allow_any_redirect_uri` tinyint(1) NOT NULL DEFAULT '0', `confidential` tinyint(1) NOT NULL DEFAULT '1', @@ -1000,22 +905,45 @@ CREATE TABLE `oauth_applications` ( KEY `index_oauth_applications_on_owner_id_and_owner_type` (`owner_id`,`owner_type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `Persons`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `Persons` ( + `id` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `subId` tinyint NOT NULL DEFAULT '1', + `name` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `countryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `gender` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '', + `year` smallint NOT NULL DEFAULT '0', + `month` tinyint NOT NULL DEFAULT '0', + `day` tinyint NOT NULL DEFAULT '0', + `comments` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `rails_id` int NOT NULL AUTO_INCREMENT, + `incorrect_wca_id_claim_count` int NOT NULL DEFAULT '0', + PRIMARY KEY (`rails_id`), + UNIQUE KEY `index_Persons_on_id_and_subId` (`id`,`subId`), + KEY `Persons_fk_country` (`countryId`), + KEY `Persons_id` (`id`), + KEY `Persons_name` (`name`), + FULLTEXT KEY `index_Persons_on_name` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `poll_options`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `poll_options` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int NOT NULL AUTO_INCREMENT, `description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `poll_id` int(11) NOT NULL, + `poll_id` int NOT NULL, PRIMARY KEY (`id`), KEY `poll_id` (`poll_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `polls`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `polls` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int NOT NULL AUTO_INCREMENT, `question` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `multiple` tinyint(1) NOT NULL, `deadline` datetime NOT NULL, @@ -1028,10 +956,10 @@ CREATE TABLE `polls` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `post_tags`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `post_tags` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `post_id` int(11) NOT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `post_id` int NOT NULL, `tag` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_post_tags_on_post_id_and_tag` (`post_id`,`tag`), @@ -1041,14 +969,14 @@ CREATE TABLE `post_tags` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `posts`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `posts` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int NOT NULL AUTO_INCREMENT, `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `body` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `slug` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `sticky` tinyint(1) NOT NULL DEFAULT '0', - `author_id` int(11) DEFAULT NULL, + `author_id` int DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `show_on_homepage` tinyint(1) NOT NULL DEFAULT '1', @@ -1062,11 +990,11 @@ CREATE TABLE `posts` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `preferred_formats`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `preferred_formats` ( `event_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `format_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `ranking` int(11) NOT NULL, + `ranking` int NOT NULL, UNIQUE KEY `index_preferred_formats_on_event_id_and_format_id` (`event_id`,`format_id`), KEY `fk_rails_c3e0098ed3` (`format_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -1074,7 +1002,7 @@ CREATE TABLE `preferred_formats` ( DROP TABLE IF EXISTS `rails_persons`; /*!50001 DROP VIEW IF EXISTS `rails_persons`*/; SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; +/*!50503 SET character_set_client = utf8mb4 */; /*!50001 CREATE VIEW `rails_persons` AS SELECT 1 AS `id`, 1 AS `wca_id`, @@ -1088,11 +1016,43 @@ SET character_set_client = utf8; 1 AS `comments`, 1 AS `incorrect_wca_id_claim_count`*/; SET character_set_client = @saved_cs_client; +DROP TABLE IF EXISTS `RanksAverage`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `RanksAverage` ( + `id` int NOT NULL AUTO_INCREMENT, + `personId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `best` int NOT NULL DEFAULT '0', + `worldRank` int NOT NULL DEFAULT '0', + `continentRank` int NOT NULL DEFAULT '0', + `countryRank` int NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `fk_persons` (`personId`), + KEY `fk_events` (`eventId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `RanksSingle`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `RanksSingle` ( + `id` int NOT NULL AUTO_INCREMENT, + `personId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `best` int NOT NULL DEFAULT '0', + `worldRank` int NOT NULL DEFAULT '0', + `continentRank` int NOT NULL DEFAULT '0', + `countryRank` int NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `fk_persons` (`personId`), + KEY `fk_events` (`eventId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `regional_organizations`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `regional_organizations` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, + `id` bigint NOT NULL AUTO_INCREMENT, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `country` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `website` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, @@ -1114,11 +1074,11 @@ CREATE TABLE `regional_organizations` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `registration_competition_events`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `registration_competition_events` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `registration_id` int(11) DEFAULT NULL, - `competition_event_id` int(11) DEFAULT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `registration_id` int DEFAULT NULL, + `competition_event_id` int DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `idx_registration_competition_events_on_reg_id_and_comp_event_id` (`registration_id`,`competition_event_id`), KEY `index_reg_events_reg_id_comp_event_id` (`registration_id`,`competition_event_id`) @@ -1126,80 +1086,142 @@ CREATE TABLE `registration_competition_events` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `registration_payments`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `registration_payments` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `registration_id` int(11) DEFAULT NULL, - `amount_lowest_denomination` int(11) DEFAULT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `registration_id` int DEFAULT NULL, + `amount_lowest_denomination` int DEFAULT NULL, `currency_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `receipt_id` bigint DEFAULT NULL, + `receipt_type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `stripe_charge_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, - `refunded_registration_payment_id` int(11) DEFAULT NULL, - `user_id` int(11) DEFAULT NULL, + `refunded_registration_payment_id` int DEFAULT NULL, + `user_id` int DEFAULT NULL, PRIMARY KEY (`id`), KEY `index_registration_payments_on_stripe_charge_id` (`stripe_charge_id`), - KEY `idx_reg_payments_on_refunded_registration_payment_id` (`refunded_registration_payment_id`) + KEY `idx_reg_payments_on_refunded_registration_payment_id` (`refunded_registration_payment_id`), + KEY `index_registration_payments_on_receipt` (`receipt_type`,`receipt_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `registrations`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `registrations` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `competition_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `comments` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `ip` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', - `user_id` int(11) DEFAULT NULL, + `user_id` int DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, - `guests` int(11) NOT NULL DEFAULT '0', + `guests` int NOT NULL DEFAULT '0', `accepted_at` datetime DEFAULT NULL, - `accepted_by` int(11) DEFAULT NULL, + `accepted_by` int DEFAULT NULL, `deleted_at` datetime DEFAULT NULL, - `deleted_by` int(11) DEFAULT NULL, + `deleted_by` int DEFAULT NULL, `roles` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `is_competing` tinyint(1) DEFAULT '1', + `administrative_notes` text COLLATE utf8mb4_unicode_ci, PRIMARY KEY (`id`), UNIQUE KEY `index_registrations_on_competition_id_and_user_id` (`competition_id`,`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `Results`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `Results` ( + `id` int NOT NULL AUTO_INCREMENT, + `pos` smallint NOT NULL DEFAULT '0', + `personId` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `personName` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `countryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `competitionId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `roundTypeId` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `formatId` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `value1` int NOT NULL DEFAULT '0', + `value2` int NOT NULL DEFAULT '0', + `value3` int NOT NULL DEFAULT '0', + `value4` int NOT NULL DEFAULT '0', + `value5` int NOT NULL DEFAULT '0', + `best` int NOT NULL DEFAULT '0', + `average` int NOT NULL DEFAULT '0', + `regionalSingleRecord` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `regionalAverageRecord` char(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `Results_fk_tournament` (`competitionId`), + KEY `Results_fk_event` (`eventId`), + KEY `Results_fk_format` (`formatId`), + KEY `Results_fk_round` (`roundTypeId`), + KEY `Results_eventAndAverage` (`eventId`,`average`), + KEY `Results_eventAndBest` (`eventId`,`best`), + KEY `Results_regionalAverageRecordCheckSpeedup` (`eventId`,`competitionId`,`roundTypeId`,`countryId`,`average`), + KEY `Results_regionalSingleRecordCheckSpeedup` (`eventId`,`competitionId`,`roundTypeId`,`countryId`,`best`), + KEY `Results_fk_competitor` (`personId`), + KEY `index_Results_on_competitionId_and_updated_at` (`competitionId`,`updated_at`), + KEY `_tmp_index_Results_on_countryId` (`countryId`), + KEY `index_Results_on_eventId_and_value1` (`eventId`,`value1`), + KEY `index_Results_on_eventId_and_value2` (`eventId`,`value2`), + KEY `index_Results_on_eventId_and_value3` (`eventId`,`value3`), + KEY `index_Results_on_eventId_and_value4` (`eventId`,`value4`), + KEY `index_Results_on_eventId_and_value5` (`eventId`,`value5`), + KEY `index_Results_on_regionalSingleRecord_and_eventId` (`regionalSingleRecord`,`eventId`), + KEY `index_Results_on_regionalAverageRecord_and_eventId` (`regionalAverageRecord`,`eventId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci PACK_KEYS=1; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `rounds`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `rounds` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `competition_event_id` int(11) NOT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `competition_event_id` int NOT NULL, `format_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `number` int(11) NOT NULL, + `number` int NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `time_limit` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `cutoff` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `advancement_condition` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `scramble_set_count` int(11) NOT NULL DEFAULT '1', + `scramble_set_count` int NOT NULL DEFAULT '1', `round_results` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, - `total_number_of_rounds` int(11) NOT NULL, - `old_type` varchar(1) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `total_number_of_rounds` int NOT NULL, + `old_type` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_rounds_on_competition_event_id_and_number` (`competition_event_id`,`number`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `RoundTypes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `RoundTypes` ( + `id` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `rank` int NOT NULL DEFAULT '0', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `cellName` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', + `final` tinyint(1) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `sanity_check_categories`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `sanity_check_categories` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, + `id` bigint NOT NULL AUTO_INCREMENT, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `email_to` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_sanity_check_categories_on_name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `sanity_check_exclusions`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `sanity_check_exclusions` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `sanity_check_id` bigint(20) NOT NULL, + `id` bigint NOT NULL AUTO_INCREMENT, + `sanity_check_id` bigint NOT NULL, `exclusion` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `comments` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, PRIMARY KEY (`id`), @@ -1209,10 +1231,10 @@ CREATE TABLE `sanity_check_exclusions` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `sanity_checks`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `sanity_checks` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `sanity_check_category_id` bigint(20) NOT NULL, + `id` bigint NOT NULL AUTO_INCREMENT, + `sanity_check_category_id` bigint NOT NULL, `topic` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `comments` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `query` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, @@ -1224,17 +1246,17 @@ CREATE TABLE `sanity_checks` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `schedule_activities`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `schedule_activities` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, + `id` bigint NOT NULL AUTO_INCREMENT, `holder_type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `holder_id` bigint(20) NOT NULL, - `wcif_id` int(11) NOT NULL, + `holder_id` bigint NOT NULL, + `wcif_id` int NOT NULL, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `activity_code` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `start_time` datetime NOT NULL, `end_time` datetime NOT NULL, - `scramble_set_id` int(11) DEFAULT NULL, + `scramble_set_id` int DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`id`), @@ -1244,34 +1266,132 @@ CREATE TABLE `schedule_activities` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `schema_migrations`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `schema_migrations` ( - `version` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, + `version` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL, UNIQUE KEY `unique_schema_migrations` (`version`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -DROP TABLE IF EXISTS `stripe_charges`; +DROP TABLE IF EXISTS `Scrambles`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `stripe_charges` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `metadata` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, - `stripe_charge_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `Scrambles` ( + `scrambleId` int unsigned NOT NULL AUTO_INCREMENT, + `competitionId` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `eventId` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `roundTypeId` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `groupId` varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `isExtra` tinyint(1) NOT NULL, + `scrambleNum` int NOT NULL, + `scramble` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + PRIMARY KEY (`scrambleId`), + KEY `competitionId` (`competitionId`,`eventId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `starburst_announcement_views`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `starburst_announcement_views` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `user_id` int DEFAULT NULL, + `announcement_id` int DEFAULT NULL, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `starburst_announcement_view_index` (`user_id`,`announcement_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `starburst_announcements`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `starburst_announcements` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `title` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `body` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `start_delivering_at` datetime DEFAULT NULL, + `stop_delivering_at` datetime DEFAULT NULL, + `limit_to_users` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `created_at` datetime NOT NULL, + `updated_at` datetime NOT NULL, + `category` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `stripe_payment_intents`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `stripe_payment_intents` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `holder_type` varchar(191) DEFAULT NULL, + `holder_id` bigint DEFAULT NULL, + `stripe_transaction_id` bigint DEFAULT NULL, + `client_secret` text, + `error_details` text, + `created_at` datetime(6) NOT NULL, + `updated_at` datetime(6) NOT NULL, + `user_id` int DEFAULT NULL, + `confirmed_at` datetime(6) DEFAULT NULL, + `confirmed_by_type` varchar(191) DEFAULT NULL, + `confirmed_by_id` bigint DEFAULT NULL, + `canceled_at` datetime(6) DEFAULT NULL, + `canceled_by_type` varchar(191) DEFAULT NULL, + `canceled_by_id` bigint DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `index_stripe_payment_intents_on_holder` (`holder_type`,`holder_id`), + KEY `index_stripe_payment_intents_on_stripe_transaction_id` (`stripe_transaction_id`), + KEY `index_stripe_payment_intents_on_user_id` (`user_id`), + KEY `index_stripe_payment_intents_on_confirmed_by` (`confirmed_by_type`,`confirmed_by_id`), + KEY `index_stripe_payment_intents_on_canceled_by` (`canceled_by_type`,`canceled_by_id`), + CONSTRAINT `fk_rails_2dbc373c0c` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`), + CONSTRAINT `fk_rails_81f3af31de` FOREIGN KEY (`stripe_transaction_id`) REFERENCES `stripe_transactions` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `stripe_transactions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `stripe_transactions` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `api_type` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `parameters` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `stripe_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `amount_stripe_denomination` int DEFAULT NULL, + `currency_code` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `status` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `error` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, + `account_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, + `parent_transaction_id` bigint DEFAULT NULL, PRIMARY KEY (`id`), - KEY `index_stripe_charges_on_status` (`status`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + KEY `index_stripe_transactions_on_status` (`status`), + KEY `index_stripe_transactions_on_parent_transaction_id` (`parent_transaction_id`), + CONSTRAINT `fk_rails_6ad225b020` FOREIGN KEY (`parent_transaction_id`) REFERENCES `stripe_transactions` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `stripe_webhook_events`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!50503 SET character_set_client = utf8mb4 */; +CREATE TABLE `stripe_webhook_events` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `stripe_id` varchar(191) DEFAULT NULL, + `event_type` varchar(191) DEFAULT NULL, + `account_id` varchar(191) DEFAULT NULL, + `handled` tinyint(1) DEFAULT NULL, + `stripe_transaction_id` bigint DEFAULT NULL, + `created_at` datetime(6) NOT NULL, + `updated_at` datetime(6) NOT NULL, + PRIMARY KEY (`id`), + KEY `index_stripe_webhook_events_on_stripe_transaction_id` (`stripe_transaction_id`), + CONSTRAINT `fk_rails_44a72b44fd` FOREIGN KEY (`stripe_transaction_id`) REFERENCES `stripe_transactions` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `team_members`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `team_members` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `team_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `team_id` int NOT NULL, + `user_id` int NOT NULL, `start_date` date NOT NULL, `end_date` date DEFAULT NULL, `team_leader` tinyint(1) NOT NULL DEFAULT '0', @@ -1283,9 +1403,9 @@ CREATE TABLE `team_members` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `teams`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `teams` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int NOT NULL AUTO_INCREMENT, `friendly_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, @@ -1297,7 +1417,7 @@ CREATE TABLE `teams` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `timestamps`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `timestamps` ( `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `date` datetime DEFAULT NULL, @@ -1306,9 +1426,9 @@ CREATE TABLE `timestamps` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `uploaded_jsons`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `uploaded_jsons` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, + `id` bigint NOT NULL AUTO_INCREMENT, `competition_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `json_str` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, PRIMARY KEY (`id`), @@ -1317,10 +1437,10 @@ CREATE TABLE `uploaded_jsons` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `user_preferred_events`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `user_preferred_events` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `user_id` int(11) DEFAULT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `user_id` int DEFAULT NULL, `event_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_user_preferred_events_on_user_id_and_event_id` (`user_id`,`event_id`) @@ -1328,15 +1448,15 @@ CREATE TABLE `user_preferred_events` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `users`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `users` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int NOT NULL AUTO_INCREMENT, `email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `encrypted_password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `reset_password_token` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `reset_password_sent_at` datetime DEFAULT NULL, `remember_created_at` datetime DEFAULT NULL, - `sign_in_count` int(11) NOT NULL DEFAULT '0', + `sign_in_count` int NOT NULL DEFAULT '0', `current_sign_in_at` datetime DEFAULT NULL, `last_sign_in_at` datetime DEFAULT NULL, `current_sign_in_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -1349,21 +1469,21 @@ CREATE TABLE `users` ( `updated_at` datetime DEFAULT NULL, `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `delegate_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `senior_delegate_id` int(11) DEFAULT NULL, + `senior_delegate_id` int DEFAULT NULL, `region` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `wca_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `pending_avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `saved_avatar_crop_x` int(11) DEFAULT NULL, - `saved_avatar_crop_y` int(11) DEFAULT NULL, - `saved_avatar_crop_w` int(11) DEFAULT NULL, - `saved_avatar_crop_h` int(11) DEFAULT NULL, - `saved_pending_avatar_crop_x` int(11) DEFAULT NULL, - `saved_pending_avatar_crop_y` int(11) DEFAULT NULL, - `saved_pending_avatar_crop_w` int(11) DEFAULT NULL, - `saved_pending_avatar_crop_h` int(11) DEFAULT NULL, + `saved_avatar_crop_x` int DEFAULT NULL, + `saved_avatar_crop_y` int DEFAULT NULL, + `saved_avatar_crop_w` int DEFAULT NULL, + `saved_avatar_crop_h` int DEFAULT NULL, + `saved_pending_avatar_crop_x` int DEFAULT NULL, + `saved_pending_avatar_crop_y` int DEFAULT NULL, + `saved_pending_avatar_crop_w` int DEFAULT NULL, + `saved_pending_avatar_crop_h` int DEFAULT NULL, `unconfirmed_wca_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `delegate_id_to_handle_wca_id_claim` int(11) DEFAULT NULL, + `delegate_id_to_handle_wca_id_claim` int DEFAULT NULL, `dob` date DEFAULT NULL, `gender` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `country_iso2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, @@ -1372,14 +1492,13 @@ CREATE TABLE `users` ( `competition_notifications_enabled` tinyint(1) DEFAULT NULL, `receive_delegate_reports` tinyint(1) NOT NULL DEFAULT '0', `dummy_account` tinyint(1) NOT NULL DEFAULT '0', - `encrypted_otp_secret` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `encrypted_otp_secret_iv` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `encrypted_otp_secret_salt` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `consumed_timestep` int(11) DEFAULT NULL, + `consumed_timestep` int DEFAULT NULL, `otp_required_for_login` tinyint(1) DEFAULT '0', `otp_backup_codes` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, `session_validity_token` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `cookies_acknowledged` tinyint(1) NOT NULL DEFAULT '0', + `registration_notifications_enabled` tinyint(1) DEFAULT '0', + `otp_secret` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `index_users_on_email` (`email`), UNIQUE KEY `index_users_on_reset_password_token` (`reset_password_token`), @@ -1390,11 +1509,11 @@ CREATE TABLE `users` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `venue_rooms`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `venue_rooms` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `competition_venue_id` bigint(20) NOT NULL, - `wcif_id` int(11) NOT NULL, + `id` bigint NOT NULL AUTO_INCREMENT, + `competition_venue_id` bigint NOT NULL, + `wcif_id` int NOT NULL, `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, @@ -1406,31 +1525,31 @@ CREATE TABLE `venue_rooms` ( /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `vote_options`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `vote_options` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `vote_id` int(11) NOT NULL, - `poll_option_id` int(11) NOT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `vote_id` int NOT NULL, + `poll_option_id` int NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `votes`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `votes` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `user_id` int(11) NOT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `user_id` int NOT NULL, `comment` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `poll_id` int(11) DEFAULT NULL, + `poll_id` int DEFAULT NULL, PRIMARY KEY (`id`), KEY `index_votes_on_user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `wcif_extensions`; /*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; +/*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `wcif_extensions` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, + `id` bigint NOT NULL AUTO_INCREMENT, `extendable_type` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `extendable_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `extension_id` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, @@ -1448,7 +1567,7 @@ CREATE TABLE `wcif_extensions` ( /*!50001 SET character_set_results = utf8mb4 */; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50001 VIEW `rails_persons` AS select `Persons`.`rails_id` AS `id`,`Persons`.`id` AS `wca_id`,`Persons`.`subId` AS `subId`,`Persons`.`name` AS `name`,`Persons`.`countryId` AS `countryId`,`Persons`.`gender` AS `gender`,`Persons`.`year` AS `year`,`Persons`.`month` AS `month`,`Persons`.`day` AS `day`,`Persons`.`comments` AS `comments`,`Persons`.`incorrect_wca_id_claim_count` AS `incorrect_wca_id_claim_count` from `Persons` */; +/*!50001 VIEW `rails_persons` AS select `persons`.`rails_id` AS `id`,`persons`.`id` AS `wca_id`,`persons`.`subId` AS `subId`,`persons`.`name` AS `name`,`persons`.`countryId` AS `countryId`,`persons`.`gender` AS `gender`,`persons`.`year` AS `year`,`persons`.`month` AS `month`,`persons`.`day` AS `day`,`persons`.`comments` AS `comments`,`persons`.`incorrect_wca_id_claim_count` AS `incorrect_wca_id_claim_count` from `persons` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -1707,4 +1826,40 @@ INSERT INTO `schema_migrations` (version) VALUES ('20210301002636'), ('20210325202019'), ('20210501213332'), -('20210727081850'); +('20210506205912'), +('20210521195423'), +('20210727081850'), +('20210802065056'), +('20211031152615'), +('20211031152616'), +('20211031152617'), +('20211031154101'), +('20211210100657'), +('20220223163446'), +('20220223163447'), +('20220511025003'), +('20220516124717'), +('20220619200832'), +('20220623121810'), +('20220627195217'), +('20220630233246'), +('20220706232200'), +('20220725045202'), +('20220725045819'), +('20220804193822'), +('20220822232936'), +('20220916132536'), +('20221121111430'), +('20221123090104'), +('20221123121220'), +('20221224215048'), +('20230119115432'), +('20230204111111'), +('20230303093411'), +('20230311165116'), +('20230311183558'), +('20230312182740'), +('20230315170143'), +('20230515103948'), +('20230517135741'), +('20230619013537'); diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml deleted file mode 100644 index 5572a18..0000000 --- a/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - UTF-8 - ${PATTERN_LOG} - - - - - ${LOG_PATH}/db-sanity-check.log - - ${LOG_PATH}/db-sanity-check_%d{yyyy-MM-dd}.%i.log - - - 5MB - - 30 - - - UTF-8 - %d %-4relative [%thread] %-5level %logger{35} - %msg%n - - - - - - - - - - \ No newline at end of file diff --git a/src/test/java/org/worldcubeassociation/dbsanitycheck/integration/service/WrtSanityCheckServiceTest.java b/src/test/java/org/worldcubeassociation/dbsanitycheck/integration/service/WrtSanityCheckServiceTest.java index c53765d..02009dc 100644 --- a/src/test/java/org/worldcubeassociation/dbsanitycheck/integration/service/WrtSanityCheckServiceTest.java +++ b/src/test/java/org/worldcubeassociation/dbsanitycheck/integration/service/WrtSanityCheckServiceTest.java @@ -17,13 +17,15 @@ import org.worldcubeassociation.dbsanitycheck.service.WrtSanityCheckService; import org.worldcubeassociation.dbsanitycheck.util.EmailUtil; +import java.io.IOException; +import java.util.List; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.internet.MimeMessage; -import java.io.IOException; -import java.util.List; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @Slf4j @SpringBootTest @@ -52,13 +54,15 @@ private void setup() { public void regularWorkflow() throws MessagingException, IOException { wrtSanityCheckService.execute(); + // 2 emails are sent, I'm not sure how to get all of them in the test. Ideally, we would get each one and + // validate individually String result = getEmailResult(); - validateHtmlResponse(result); } private String getEmailResult() throws MessagingException, IOException { - verify(emailSender, times(1)).send(messageCaptor.capture()); + // There are 2 different emails sent as mail_to in the categories table + verify(emailSender, times(2)).send(messageCaptor.capture()); List messages = messageCaptor.getAllValues(); diff --git a/src/test/java/org/worldcubeassociation/dbsanitycheck/util/EmailUtil.java b/src/test/java/org/worldcubeassociation/dbsanitycheck/util/EmailUtil.java index 804a873..2b97052 100644 --- a/src/test/java/org/worldcubeassociation/dbsanitycheck/util/EmailUtil.java +++ b/src/test/java/org/worldcubeassociation/dbsanitycheck/util/EmailUtil.java @@ -1,12 +1,12 @@ package org.worldcubeassociation.dbsanitycheck.util; +import java.io.IOException; +import java.util.List; import javax.mail.BodyPart; import javax.mail.MessagingException; import javax.mail.internet.ContentType; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; -import java.io.IOException; -import java.util.List; public final class EmailUtil { private EmailUtil() { @@ -45,8 +45,7 @@ private static String getTextFromBodyPart( } else if (bodyPart.isMimeType("text/plain")) { result = (String) bodyPart.getContent(); } else if (bodyPart.isMimeType("text/html")) { - String html = (String) bodyPart.getContent(); - result = html; + result = (String) bodyPart.getContent(); } return result; } diff --git a/src/test/resources/responses/wrt-sanity-check-service-test/regularWorkflow.html b/src/test/resources/responses/wrt-sanity-check-service-test/regularWorkflow.html index c06110d..148aa1a 100644 --- a/src/test/resources/responses/wrt-sanity-check-service-test/regularWorkflow.html +++ b/src/test/resources/responses/wrt-sanity-check-service-test/regularWorkflow.html @@ -9,35 +9,9 @@

Sanity Check Results

-

Found inconsistencies in 2 topics.

+

Found inconsistencies in 1 topics.

-

1. [Person Data Irregularities] Names with numbers

-
- - - - - - - - - - - - - - - - - - - - -
subIdcommentsgendermonthyearnameincorrect_wca_id_claim_countiddaycountryIdrails_id
2f121954Dottie Marsh 201982FRID014Czech Republic5
-
-
- -

2. [User Data Irregularities] Inconsistent name in users table

+

1. [User Data Irregularities] Inconsistent name in users table

@@ -55,12 +29,7 @@

2. [User Data Irregularities] Inconsistent name in users table


-

Found errors in 1 queries.

- -

1. [Person Data Irregularities] Query with error

-CELECT * FROM Persons WHERE name REGEXP '[0-9]' -

Reason: StatementCallback; bad SQL grammar [CELECT * FROM Persons WHERE name REGEXP '[0-9]']; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CELECT * FROM Persons WHERE name REGEXP '[0-9]'' at line 1

-
+

There is no query with SQL errors.

diff --git a/src/test/resources/test-scripts/regularWorkflow.sql b/src/test/resources/test-scripts/regularWorkflow.sql index b4bad18..0250f99 100644 --- a/src/test/resources/test-scripts/regularWorkflow.sql +++ b/src/test/resources/test-scripts/regularWorkflow.sql @@ -1,10 +1,10 @@ -- Create categories insert into - sanity_check_categories (id, name) + sanity_check_categories (id, name, email_to) values - (1, 'Person Data Irregularities'), - (2, 'Irregular Results'), - (3, 'User Data Irregularities'); + (1, 'Person Data Irregularities', 'test1@email.com'), + (2, 'Irregular Results', 'test1@email.com'), + (3, 'User Data Irregularities', 'test2@email.com'); -- Insert sanity check insert into