-- https://www.phpmyadmin.net/
--

START TRANSACTION;

--
-- Database: `enth_docker`
--
CREATE DATABASE IF NOT EXISTS `enth_docker` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `enth_docker`;

-- --------------------------------------------------------

--
-- Table structure for table `affiliates`
--

CREATE TABLE `affiliates` (
  `affiliateid` int(5) NOT NULL,
  `url` varchar(254) NOT NULL DEFAULT '',
  `title` varchar(254) NOT NULL DEFAULT '',
  `imagefile` varchar(254) DEFAULT NULL,
  `email` varchar(255) NOT NULL DEFAULT '',
  `added` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `category`
--

CREATE TABLE `category` (
  `catid` int(5) NOT NULL,
  `catname` varchar(255) NOT NULL DEFAULT '',
  `parent` int(5) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `category`
--

INSERT INTO `category` (`catid`, `catname`, `parent`) VALUES
(1, 'Academia', 0),
(2, 'Actors', 0),
(3, 'Actresses', 0),
(4, 'Adult', 0),
(5, 'Advertising/TV Channels', 0),
(6, 'Albums', 0),
(7, 'Animals', 0),
(8, 'Animation', 0),
(9, 'Anime/Manga: Adult', 0),
(10, 'Anime/Manga: Characters 0-M', 0),
(11, 'Anime/Manga: Characters N-Z', 0),
(12, 'Anime/Manga: Companies', 0),
(13, 'Anime/Manga: Episodes', 0),
(14, 'Anime/Manga: Fanstuff', 0),
(15, 'Anime/Manga: General', 0),
(16, 'Anime/Manga: Items/Locations', 0),
(17, 'Anime/Manga: Magazines', 0),
(18, 'Anime/Manga: Manga-ka/Directors', 0),
(19, 'Anime/Manga: Movies/OVAs', 0),
(20, 'Anime/Manga: Music', 0),
(21, 'Anime/Manga: Relationships', 0),
(22, 'Anime/Manga: Rivalries', 0),
(23, 'Anime/Manga: Series', 0),
(24, 'Anime/Manga: Songs', 0),
(25, 'Anime/Manga: Toys/Collectibles', 0),
(26, 'Anime/Manga: Websites', 0),
(27, 'Arts and Design', 0),
(28, 'Authors/Writers', 0),
(29, 'Characters: Book/Movie', 0),
(30, 'Characters: TV', 0),
(31, 'Comics', 0),
(32, 'Computer Miscellany and Internet', 0),
(33, 'Directors/Producers', 0),
(34, 'Episodes', 0),
(35, 'Fan Works', 0),
(36, 'Fashion/Beauty', 0),
(37, 'Food/Drinks', 0),
(38, 'Games', 0),
(39, 'History/Royalty', 0),
(40, 'Hobbies and Recreation', 0),
(41, 'Literature', 0),
(42, 'Magazines/Newspapers', 0),
(43, 'Miscellaneous', 0),
(44, 'Models', 0),
(45, 'Movies', 0),
(46, 'Music Miscellany', 0),
(47, 'Musicians: Bands/Groups', 0),
(48, 'Musicians: Female', 0),
(49, 'Musicians: Male', 0),
(50, 'Mythology/Religion', 0),
(51, 'Nature', 0),
(52, 'Objects', 0),
(53, 'People Miscellany', 0),
(54, 'Places', 0),
(55, 'Politics and Organisations', 0),
(56, 'Radio', 0),
(57, 'Relationships: Book/Movie', 0),
(58, 'Relationships: Real Life', 0),
(59, 'Relationships: TV', 0),
(60, 'Songs: Bands/Groups 0-M', 0),
(61, 'Songs: Bands/Groups N-Z', 0),
(62, 'Songs: Female Solo', 0),
(63, 'Songs: Male Solo', 0),
(64, 'Songs: Various', 0),
(65, 'Sports', 0),
(66, 'Sports Entertainment', 0),
(67, 'Stage/Theatre', 0),
(68, 'Toys/Collectibles', 0),
(69, 'Transportation', 0),
(70, 'TV/Stage Personalities', 0),
(71, 'TV Shows', 0),
(72, 'TV/Movie/Book Miscellany', 0),
(73, 'Webmasters', 0),
(74, 'Websites', 0);

-- --------------------------------------------------------

--
-- Table structure for table `emailtemplate`
--

CREATE TABLE `emailtemplate` (
  `templateid` int(3) NOT NULL,
  `templatename` varchar(255) NOT NULL DEFAULT '',
  `subject` varchar(255) NOT NULL DEFAULT '',
  `content` mediumtext NOT NULL,
  `deletable` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `emailtemplate`
--

INSERT INTO `emailtemplate` (`templateid`, `templatename`, `subject`, `content`, `deletable`) VALUES
(1, 'Add Affiliate Template', 'Affiliation with $$site_title$$', 'Hello!\r\n\r\nThis is a notification for you to know that I have just added your site, $$site_aff_title$$ ($$site_aff_url$$) as an affiliate at $$site_title$$, found at $$site_url$$. :)\r\n\r\nSincerely,\r\n$$site_owner$$', 0);

-- --------------------------------------------------------

--
-- Table structure for table `errorlog`
--

CREATE TABLE `errorlog` (
  `date` datetime NOT NULL,
  `source` varchar(100) NOT NULL,
  `log` mediumtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `joined`
--

CREATE TABLE `joined` (
  `joinedid` int(10) NOT NULL,
  `catid` varchar(255) NOT NULL DEFAULT '0',
  `url` varchar(255) NOT NULL DEFAULT '',
  `subject` varchar(255) NOT NULL DEFAULT '',
  `desc` mediumtext,
  `comments` mediumtext,
  `imagefile` varchar(255) DEFAULT NULL,
  `added` date DEFAULT NULL,
  `pending` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `joined`
--

INSERT INTO `joined` (`joinedid`, `catid`, `url`, `subject`, `desc`, `comments`, `imagefile`, `added`, `pending`) VALUES
(1, '|1|', 'http://1234.com', 'Subj1', '', '', '', '2019-02-17', 0),
(2, '|2|', 'http://12344.com', 'Subj2', '', '', '', '2019-02-19', 0);

-- --------------------------------------------------------

--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `setting` varchar(255) NOT NULL DEFAULT '',
  `title` varchar(255) NOT NULL DEFAULT '',
  `value` mediumtext NOT NULL,
  `help` mediumtext NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;



DROP procedure if exists InsertRand;

DELIMITER $$
CREATE PROCEDURE InsertRand(IN NumRows INT)
    BEGIN
        DECLARE i INT;
        DECLARE email VARCHAR(40);
        SET i = 1;
        START TRANSACTION;
        WHILE i <= NumRows DO
            SET email = CONCAT('email', CEIL(RAND() * 100), '.', i, '@localhost123456.com');
            SET i = i + 1;
        END WHILE;
        COMMIT;
    END$$
DELIMITER ;

CALL InsertRand(2000);

-- --------------------------------------------------------

--
-- Table structure for table `table1_affiliates`
--

CREATE TABLE `table1_affiliates` (
  `affiliateid` int(5) NOT NULL,
  `url` varchar(255) NOT NULL DEFAULT '',
  `title` varchar(255) NOT NULL DEFAULT '',
  `imagefile` varchar(255) DEFAULT NULL,
  `email` varchar(255) NOT NULL DEFAULT '',
  `added` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `affiliates`
--
ALTER TABLE `affiliates`
  ADD PRIMARY KEY (`affiliateid`);

--
-- Indexes for table `category`
--
ALTER TABLE `category`
  ADD PRIMARY KEY (`catid`);

--
-- Indexes for table `emailtemplate`
--
ALTER TABLE `emailtemplate`
  ADD PRIMARY KEY (`templateid`);

--
-- Indexes for table `joined`
--
ALTER TABLE `joined`
  ADD PRIMARY KEY (`joinedid`);
ALTER TABLE `joined` ADD FULLTEXT KEY `subject` (`subject`,`desc`,`comments`);

--
-- Indexes for table `settings`
--
ALTER TABLE `settings`
  ADD PRIMARY KEY (`setting`);

--
-- Indexes for table `table1_affiliates`
--
ALTER TABLE `table1_affiliates`
  ADD PRIMARY KEY (`affiliateid`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `affiliates`
--
ALTER TABLE `affiliates`
  MODIFY `affiliateid` int(5) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
  MODIFY `catid` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=75;

--
-- AUTO_INCREMENT for table `emailtemplate`
--
ALTER TABLE `emailtemplate`
  MODIFY `templateid` int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `joined`
--
ALTER TABLE `joined`
  MODIFY `joinedid` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `table1_affiliates`
--
ALTER TABLE `table1_affiliates`
  MODIFY `affiliateid` int(5) NOT NULL AUTO_INCREMENT;
COMMIT;
