Creation des Challonges a partir des Event WordPress
This commit is contained in:
@@ -1,169 +1,212 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 4.6.4
|
||||
-- https://www.phpmyadmin.net/
|
||||
-- MySQL dump 10.13 Distrib 5.7.12, for Win64 (x86_64)
|
||||
--
|
||||
-- Host: localhost
|
||||
-- Generation Time: Oct 06, 2018 at 10:12 PM
|
||||
-- Server version: 5.6.40-log
|
||||
-- PHP Version: 7.1.18
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
-- Host: api.ladose.net Database: ladoseapi
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.6.40-log
|
||||
|
||||
/*!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 */;
|
||||
|
||||
--
|
||||
-- Database: `ladoseapi`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!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 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `ApplicationUser`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `ApplicationUser`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `ApplicationUser` (
|
||||
`Id` int(11) NOT NULL,
|
||||
`Id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`FirstName` varchar(45) DEFAULT NULL,
|
||||
`LastName` varchar(45) DEFAULT NULL,
|
||||
`UserName` varchar(45) DEFAULT NULL,
|
||||
`PasswordHash` blob,
|
||||
`PasswordSalt` blob
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
`PasswordSalt` blob,
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `Event`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `Event`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `Event` (
|
||||
`Id` int(11) NOT NULL,
|
||||
`Id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Name` varchar(255) NOT NULL,
|
||||
`Date` datetime NOT NULL,
|
||||
`SeasonId` int(11) NOT NULL,
|
||||
`Ranking` tinyint(4) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
`Ranking` tinyint(4) DEFAULT NULL,
|
||||
PRIMARY KEY (`Id`),
|
||||
KEY `SeasonPK_idx` (`SeasonId`),
|
||||
CONSTRAINT `SeasonsPK` FOREIGN KEY (`SeasonId`) REFERENCES `Season` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
--
|
||||
-- Table structure for table `EventGame`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `EventGame`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `EventGame` (
|
||||
`EventId` int(11) NOT NULL,
|
||||
`GameId` int(11) NOT NULL,
|
||||
`ChallongeId` int(11) DEFAULT NULL,
|
||||
`ChallongeUrl` varchar(250) DEFAULT NULL,
|
||||
PRIMARY KEY (`EventId`,`GameId`),
|
||||
KEY `GamePK_idx` (`GameId`),
|
||||
CONSTRAINT `EventGame_EventPK` FOREIGN KEY (`EventId`) REFERENCES `Event` (`Id`),
|
||||
CONSTRAINT `EventGame_GamePk` FOREIGN KEY (`GameId`) REFERENCES `Game` (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `Game`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `Game`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `Game` (
|
||||
`Id` int(11) NOT NULL,
|
||||
`Id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Name` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
|
||||
`ImgUrl` varchar(255) CHARACTER SET utf8 DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
`ImgUrl` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
|
||||
PRIMARY KEY (`Id`),
|
||||
UNIQUE KEY `name_UNIQUE` (`Name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `Season`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `Season`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `Season` (
|
||||
`Id` int(11) NOT NULL,
|
||||
`Id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Name` varchar(45) DEFAULT NULL,
|
||||
`StartDate` datetime DEFAULT NULL,
|
||||
`EndDate` datetime DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
`EndDate` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`Id`),
|
||||
UNIQUE KEY `Name_UNIQUE` (`Name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `SeasonGame`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `SeasonGame`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `SeasonGame` (
|
||||
`SeasonId` int(11) NOT NULL,
|
||||
`GameId` int(11) NOT NULL
|
||||
`GameId` int(11) NOT NULL,
|
||||
PRIMARY KEY (`SeasonId`,`GameId`),
|
||||
KEY `GamePK_idx` (`GameId`),
|
||||
CONSTRAINT `GamePK` FOREIGN KEY (`GameId`) REFERENCES `Game` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT `SeasonPK` FOREIGN KEY (`SeasonId`) REFERENCES `Season` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Indexes for dumped tables
|
||||
-- Table structure for table `WPBooking`
|
||||
--
|
||||
|
||||
--
|
||||
-- Indexes for table `ApplicationUser`
|
||||
--
|
||||
ALTER TABLE `ApplicationUser`
|
||||
ADD PRIMARY KEY (`Id`);
|
||||
DROP TABLE IF EXISTS `WPBooking`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `WPBooking` (
|
||||
`WPEventId` int(11) DEFAULT NULL,
|
||||
`WPUserId` int(11) DEFAULT NULL,
|
||||
`Message` varchar(5000) DEFAULT NULL,
|
||||
`Meta` varchar(5000) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Indexes for table `Event`
|
||||
--
|
||||
ALTER TABLE `Event`
|
||||
ADD PRIMARY KEY (`Id`),
|
||||
ADD KEY `SeasonPK_idx` (`SeasonId`);
|
||||
|
||||
--
|
||||
-- Indexes for table `Game`
|
||||
--
|
||||
ALTER TABLE `Game`
|
||||
ADD PRIMARY KEY (`Id`),
|
||||
ADD UNIQUE KEY `name_UNIQUE` (`Name`);
|
||||
|
||||
--
|
||||
-- Indexes for table `Season`
|
||||
--
|
||||
ALTER TABLE `Season`
|
||||
ADD PRIMARY KEY (`Id`),
|
||||
ADD UNIQUE KEY `Name_UNIQUE` (`Name`);
|
||||
|
||||
--
|
||||
-- Indexes for table `SeasonGame`
|
||||
--
|
||||
ALTER TABLE `SeasonGame`
|
||||
ADD PRIMARY KEY (`SeasonId`,`GameId`),
|
||||
ADD KEY `GamePK_idx` (`GameId`);
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for dumped tables
|
||||
-- Table structure for table `WPEvent`
|
||||
--
|
||||
|
||||
--
|
||||
-- AUTO_INCREMENT for table `ApplicationUser`
|
||||
--
|
||||
ALTER TABLE `ApplicationUser`
|
||||
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
|
||||
--
|
||||
-- AUTO_INCREMENT for table `Event`
|
||||
--
|
||||
ALTER TABLE `Event`
|
||||
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
|
||||
--
|
||||
-- AUTO_INCREMENT for table `Game`
|
||||
--
|
||||
ALTER TABLE `Game`
|
||||
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
|
||||
--
|
||||
-- AUTO_INCREMENT for table `Season`
|
||||
--
|
||||
ALTER TABLE `Season`
|
||||
MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
|
||||
--
|
||||
-- Constraints for dumped tables
|
||||
--
|
||||
DROP TABLE IF EXISTS `WPEvent`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `WPEvent` (
|
||||
`Id` int(11) NOT NULL,
|
||||
`Name` varchar(255) DEFAULT NULL,
|
||||
`Slug` varchar(255) DEFAULT NULL,
|
||||
`Date` date DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Constraints for table `Event`
|
||||
-- Table structure for table `WPUser`
|
||||
--
|
||||
ALTER TABLE `Event`
|
||||
ADD CONSTRAINT `SeasonsPK` FOREIGN KEY (`SeasonId`) REFERENCES `Season` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
|
||||
DROP TABLE IF EXISTS `WPUser`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `WPUser` (
|
||||
`Id` int(11) NOT NULL,
|
||||
`Name` varchar(45) DEFAULT NULL,
|
||||
`WPUserLogin` varchar(45) DEFAULT NULL,
|
||||
`WPMail` varchar(45) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Constraints for table `SeasonGame`
|
||||
-- Dumping routines for database 'ladoseapi'
|
||||
--
|
||||
ALTER TABLE `SeasonGame`
|
||||
ADD CONSTRAINT `GamePK` FOREIGN KEY (`GameId`) REFERENCES `Game` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
ADD CONSTRAINT `SeasonPK` FOREIGN KEY (`SeasonId`) REFERENCES `Season` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
|
||||
/*!50003 DROP PROCEDURE IF EXISTS `ImportEvent` */;
|
||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||
/*!50003 SET character_set_client = utf8 */ ;
|
||||
/*!50003 SET character_set_results = utf8 */ ;
|
||||
/*!50003 SET collation_connection = utf8_general_ci */ ;
|
||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||
/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;
|
||||
DELIMITER ;;
|
||||
CREATE DEFINER=`ladoseapi`@`%` PROCEDURE `ImportEvent`()
|
||||
BEGIN
|
||||
INSERT INTO WPEvent (Id, Name,Slug,Date )
|
||||
select event_id, event_name,event_slug, event_start_date from ladose.wp_em_events
|
||||
where event_id not in (select Id from WPEvent);
|
||||
|
||||
INSERT INTO WPUser (Id, Name, WPUSerLogin, WPMail)
|
||||
select ID, display_name, user_login , user_email from ladose.wp_users
|
||||
where ID not in (select Id from WPUser);
|
||||
|
||||
INSERT INTO WPBooking (WPEventId, WPUserId, Message, Meta)
|
||||
select event_id, person_id, booking_comment , booking_meta from ladose.wp_em_bookings
|
||||
where (event_id , person_id) not in (select WPEventId,WPUserId from WPBooking);
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
||||
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
||||
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2018-10-08 23:31:28
|
||||
i
|
||||
|
||||
Reference in New Issue
Block a user