-- MySQL dump 10.14  Distrib 5.5.60-MariaDB, for Linux (x86_64)
--
-- Host: localhost    Database: testmysqlorm
-- ------------------------------------------------------
-- Server version	5.5.60-MariaDB

/*!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 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 */;

--
-- Current Database: `testmysqlorm`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `testmysqlorm` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `testmysqlorm`;

--
-- Table structure for table `league`
--

DROP TABLE IF EXISTS `league`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `league` (
  `league_id` int(11) NOT NULL AUTO_INCREMENT,
  `league_name` varchar(20) NOT NULL,
  `sport_id` int(11) NOT NULL,
  `fk_test_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`league_id`),
  UNIQUE KEY `league_name_ak` (`league_name`,`sport_id`),
  KEY `sport_id` (`sport_id`),
  KEY `league_ibfk_2` (`fk_test_id`),
  CONSTRAINT `league_ibfk_1` FOREIGN KEY (`sport_id`) REFERENCES `sport` (`sport_id`),
  CONSTRAINT `league_ibfk_2` FOREIGN KEY (`fk_test_id`) REFERENCES `testmysqlorm_fk`.`fk_test` (`fk_test_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `league`
--

LOCK TABLES `league` WRITE;
/*!40000 ALTER TABLE `league` DISABLE KEYS */;
/*!40000 ALTER TABLE `league` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `owner`
--

DROP TABLE IF EXISTS `owner`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `owner` (
  `owner_id` int(11) NOT NULL AUTO_INCREMENT,
  `owner_name` varchar(50) NOT NULL,
  PRIMARY KEY (`owner_id`),
  UNIQUE KEY `owner_name_ak` (`owner_name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `owner`
--

LOCK TABLES `owner` WRITE;
/*!40000 ALTER TABLE `owner` DISABLE KEYS */;
INSERT INTO `owner` VALUES (1,'Batman');
/*!40000 ALTER TABLE `owner` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sport`
--

DROP TABLE IF EXISTS `sport`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sport` (
  `sport_id` int(11) NOT NULL AUTO_INCREMENT,
  `sport_name` varchar(50) NOT NULL,
  PRIMARY KEY (`sport_id`),
  UNIQUE KEY `sport_name_ak` (`sport_name`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sport`
--

LOCK TABLES `sport` WRITE;
/*!40000 ALTER TABLE `sport` DISABLE KEYS */;
/*!40000 ALTER TABLE `sport` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `team`
--

DROP TABLE IF EXISTS `team`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `team` (
  `team_id` int(11) NOT NULL AUTO_INCREMENT,
  `team_name` varchar(20) NOT NULL,
  `league_id` int(11) NOT NULL,
  `city` varchar(30) NOT NULL,
  `owner_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`team_id`),
  UNIQUE KEY `team_name_ak` (`team_name`,`league_id`),
  KEY `league_id` (`league_id`),
  CONSTRAINT `team_ibfk_1` FOREIGN KEY (`league_id`) REFERENCES `league` (`league_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `team`
--

LOCK TABLES `team` WRITE;
/*!40000 ALTER TABLE `team` DISABLE KEYS */;
/*!40000 ALTER TABLE `team` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `self_ref_test`
--

DROP TABLE IF EXISTS `self_ref_test`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `self_ref_test` (
  `self_ref_test_id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_self_ref_test_id` int(11),
  `self_ref_test_code` varchar(20) NOT NULL,
  `self_ref_test_name` varchar(20) NOT NULL,
  PRIMARY KEY (`self_ref_test_id`),
  UNIQUE KEY `self_ref_test_ak` (`self_ref_test_code`),
  KEY `parent_self_ref_test_id` (`parent_self_ref_test_id`),
  CONSTRAINT `self_ref_fk_1` FOREIGN KEY (`parent_self_ref_test_id`) REFERENCES `self_ref_test` (`self_ref_test_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `self_ref_test`
--

LOCK TABLES `self_ref_test` WRITE;
/*!40000 ALTER TABLE `self_ref_test` DISABLE KEYS */;
INSERT INTO `self_ref_test` VALUES (1,null,'self_ref_test_code1','self_ref_test_name1');
/*!40000 ALTER TABLE `self_ref_test` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Current Database: `testmysqlorm_fk`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `testmysqlorm_fk` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `testmysqlorm_fk`;

--
-- Table structure for table `fk_test`
--

DROP TABLE IF EXISTS `fk_test`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `fk_test` (
  `fk_test_id` int(11) NOT NULL AUTO_INCREMENT,
  `fk_test_code` varchar(20) NOT NULL,
  `fk_test_name` varchar(20) NOT NULL,
  PRIMARY KEY (`fk_test_id`),
  UNIQUE KEY `fk_test_ak` (`fk_test_code`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `fk_test`
--

LOCK TABLES `fk_test` WRITE;
/*!40000 ALTER TABLE `fk_test` DISABLE KEYS */;
INSERT INTO `fk_test` VALUES (1,'fk_test_code1','fk_test_name1');
/*!40000 ALTER TABLE `fk_test` ENABLE KEYS */;
UNLOCK TABLES;

/*!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 2019-03-21 14:10:04