Instantly share code, notes, and snippets.
Created
July 28, 2021 12:06
-
Star
(0)
0
You must be signed in to star a gist -
Fork
(0)
0
You must be signed in to fork a gist
-
Save derduskenga/4a9b73db1216493b9ece7a8aa888810f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- phpMyAdmin SQL Dump | |
-- version 5.0.2 | |
-- https://www.phpmyadmin.net/ | |
-- | |
-- Host: 127.0.0.1 | |
-- Generation Time: Jul 28, 2021 at 02:05 PM | |
-- Server version: 10.4.13-MariaDB | |
-- PHP Version: 7.4.7 | |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | |
START TRANSACTION; | |
SET time_zone = "+00:00"; | |
/*!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: `menusurvey` | |
-- | |
-- -------------------------------------------------------- | |
-- | |
-- Table structure for table `survey` | |
-- | |
CREATE TABLE `survey` ( | |
`survey_id` int(11) NOT NULL, | |
`title` varchar(64) DEFAULT NULL, | |
`description` text DEFAULT NULL, | |
`maxi_level` int(11) DEFAULT 0 | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; | |
-- | |
-- Dumping data for table `survey` | |
-- | |
INSERT INTO `survey` (`survey_id`, `title`, `description`, `maxi_level`) VALUES | |
(1, 'Product user feedback', 'Product user feedback', 3); | |
-- -------------------------------------------------------- | |
-- | |
-- Table structure for table `survey_question` | |
-- | |
CREATE TABLE `survey_question` ( | |
`survey_question_id` int(11) NOT NULL, | |
`survey_id` int(11) DEFAULT NULL, | |
`question_level` int(11) DEFAULT NULL, | |
`question_text` varchar(128) DEFAULT NULL | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; | |
-- | |
-- Dumping data for table `survey_question` | |
-- | |
INSERT INTO `survey_question` (`survey_question_id`, `survey_id`, `question_level`, `question_text`) VALUES | |
(1, 1, 1, 'Hi Derdus, can take our survey? Reply with Yes or No '), | |
(2, 1, 2, 'Which services do you use from AT? Reply with USSD or SMS or Airtime'), | |
(3, 1, 3, 'How likely can you recommend our service to another biz; 1 – Unlikely, 2 – Undecide and 3 – Very likely '); | |
-- -------------------------------------------------------- | |
-- | |
-- Table structure for table `survey_questions_answer` | |
-- | |
CREATE TABLE `survey_questions_answer` ( | |
`survey_questions_answer_id` int(11) NOT NULL, | |
`survey_question_id` int(11) DEFAULT NULL, | |
`answer_text` varchar(32) DEFAULT NULL | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; | |
-- | |
-- Dumping data for table `survey_questions_answer` | |
-- | |
INSERT INTO `survey_questions_answer` (`survey_questions_answer_id`, `survey_question_id`, `answer_text`) VALUES | |
(10, 1, 'yes'), | |
(11, 2, 'ussd'), | |
(12, 3, '3'); | |
-- -------------------------------------------------------- | |
-- | |
-- Table structure for table `user` | |
-- | |
CREATE TABLE `user` ( | |
`user_id` int(11) NOT NULL, | |
`phone_number` varchar(32) DEFAULT NULL, | |
`name` varchar(32) DEFAULT NULL | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; | |
-- | |
-- Dumping data for table `user` | |
-- | |
INSERT INTO `user` (`user_id`, `phone_number`, `name`) VALUES | |
(1, '+254726172579', 'Derdus'); | |
-- -------------------------------------------------------- | |
-- | |
-- Table structure for table `user_survey` | |
-- | |
CREATE TABLE `user_survey` ( | |
`user_survey_id` int(11) NOT NULL, | |
`user_id` int(11) DEFAULT NULL, | |
`survey_id` int(11) DEFAULT NULL, | |
`level` int(11) DEFAULT 0, | |
`invitations_status` int(11) DEFAULT 0 | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; | |
-- | |
-- Dumping data for table `user_survey` | |
-- | |
INSERT INTO `user_survey` (`user_survey_id`, `user_id`, `survey_id`, `level`, `invitations_status`) VALUES | |
(14, 1, 1, 3, 4); | |
-- | |
-- Indexes for dumped tables | |
-- | |
-- | |
-- Indexes for table `survey` | |
-- | |
ALTER TABLE `survey` | |
ADD PRIMARY KEY (`survey_id`); | |
-- | |
-- Indexes for table `survey_question` | |
-- | |
ALTER TABLE `survey_question` | |
ADD PRIMARY KEY (`survey_question_id`), | |
ADD KEY `survey_id` (`survey_id`); | |
-- | |
-- Indexes for table `survey_questions_answer` | |
-- | |
ALTER TABLE `survey_questions_answer` | |
ADD PRIMARY KEY (`survey_questions_answer_id`), | |
ADD KEY `survey_question_id` (`survey_question_id`); | |
-- | |
-- Indexes for table `user` | |
-- | |
ALTER TABLE `user` | |
ADD PRIMARY KEY (`user_id`), | |
ADD UNIQUE KEY `phone_number` (`phone_number`); | |
-- | |
-- Indexes for table `user_survey` | |
-- | |
ALTER TABLE `user_survey` | |
ADD PRIMARY KEY (`user_survey_id`), | |
ADD KEY `user_id` (`user_id`), | |
ADD KEY `survey_id` (`survey_id`); | |
-- | |
-- AUTO_INCREMENT for dumped tables | |
-- | |
-- | |
-- AUTO_INCREMENT for table `survey` | |
-- | |
ALTER TABLE `survey` | |
MODIFY `survey_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; | |
-- | |
-- AUTO_INCREMENT for table `survey_question` | |
-- | |
ALTER TABLE `survey_question` | |
MODIFY `survey_question_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; | |
-- | |
-- AUTO_INCREMENT for table `survey_questions_answer` | |
-- | |
ALTER TABLE `survey_questions_answer` | |
MODIFY `survey_questions_answer_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; | |
-- | |
-- AUTO_INCREMENT for table `user` | |
-- | |
ALTER TABLE `user` | |
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; | |
-- | |
-- AUTO_INCREMENT for table `user_survey` | |
-- | |
ALTER TABLE `user_survey` | |
MODIFY `user_survey_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; | |
-- | |
-- Constraints for dumped tables | |
-- | |
-- | |
-- Constraints for table `survey_question` | |
-- | |
ALTER TABLE `survey_question` | |
ADD CONSTRAINT `survey_question_ibfk_1` FOREIGN KEY (`survey_id`) REFERENCES `survey` (`survey_id`); | |
-- | |
-- Constraints for table `survey_questions_answer` | |
-- | |
ALTER TABLE `survey_questions_answer` | |
ADD CONSTRAINT `survey_questions_answer_ibfk_1` FOREIGN KEY (`survey_question_id`) REFERENCES `survey_question` (`survey_question_id`); | |
-- | |
-- Constraints for table `user_survey` | |
-- | |
ALTER TABLE `user_survey` | |
ADD CONSTRAINT `user_survey_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`), | |
ADD CONSTRAINT `user_survey_ibfk_2` FOREIGN KEY (`survey_id`) REFERENCES `survey` (`survey_id`); | |
COMMIT; | |
/*!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 */; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment