diff options
author | Hannes "Brolaugh" Kindströmmer <me@brolaugh.com> | 2016-02-20 04:54:45 +0100 |
---|---|---|
committer | Hannes "Brolaugh" Kindströmmer <me@brolaugh.com> | 2016-02-20 04:54:45 +0100 |
commit | dd8be1631aebee1a485742fecceae3a742577bdb (patch) | |
tree | 04771856b2cccd8e2b15c316985feac6edcc1574 | |
parent | 11972bde67b19c4892785650d5dacfc45571a00a (diff) | |
download | tasklist-php-dd8be1631aebee1a485742fecceae3a742577bdb.zip tasklist-php-dd8be1631aebee1a485742fecceae3a742577bdb.tar.gz tasklist-php-dd8be1631aebee1a485742fecceae3a742577bdb.tar.bz2 |
Added database structure
Signed-off-by: Hannes "Brolaugh" Kindströmmer <me@brolaugh.com>
-rw-r--r-- | App/database/dbsetup.php | 8 | ||||
-rw-r--r-- | App/database/insert.php | 14 | ||||
-rw-r--r-- | Database/structure.sql | 116 |
3 files changed, 129 insertions, 9 deletions
diff --git a/App/database/dbsetup.php b/App/database/dbsetup.php index d1526c0..17f9644 100644 --- a/App/database/dbsetup.php +++ b/App/database/dbsetup.php @@ -12,10 +12,10 @@ namespace App\database; class dbSetup { private $db; - private $server; - private $username; - private $password; - private $database; + private $server = "mysql443.loopia.se"; + private $username = "brolaugh@b141659"; + private $password = "kattfanMasterrace"; + private $database = "brolaugh_se_db_3"; /** diff --git a/App/database/insert.php b/App/database/insert.php index b9230ea..b22bedd 100644 --- a/App/database/insert.php +++ b/App/database/insert.php @@ -15,8 +15,8 @@ class Insert extends dbSetup{ /** * @return array */ - public function getAllJobs(){ - $stmt = $this->getDb()->prepare(""); + public function getAllTasks(){ + $stmt = $this->getDb()->prepare("SELECT * FROM status"); $stmt->execute(); $res = $stmt->get_result(); $a = array(); @@ -26,8 +26,12 @@ class Insert extends dbSetup{ $stmt->close(); return $a; } - public function getAllUnFinishedJobs(){ - $stmt = $this->getDb()->prepare(""); + + /** + * @return array + */ + public function getAllUnFinishedTasks(){ + $stmt = $this->getDb()->prepare("SELECT * FROM status"); $stmt->execute(); $res = $stmt->get_result(); $a = array(); @@ -37,7 +41,7 @@ class Insert extends dbSetup{ $stmt->close(); return $a; } - public function getAllDoneJobs(){ + public function getAllDoneTasks(){ $stmt = $this->getDb()->prepare(""); $stmt->execute(); $res = $stmt->get_result(); diff --git a/Database/structure.sql b/Database/structure.sql new file mode 100644 index 0000000..90825da --- /dev/null +++ b/Database/structure.sql @@ -0,0 +1,116 @@ +-- phpMyAdmin SQL Dump +-- version 4.4.15.4 +-- http://www.phpmyadmin.net +-- +-- Host: s443.loopia.se +-- Generation Time: Feb 20, 2016 at 12:30 AM +-- Server version: 5.6.22-log +-- PHP Version: 5.4.30 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +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: `brolaugh_se_db_3` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `status` +-- + +CREATE TABLE IF NOT EXISTS `status` ( + `id` int(11) NOT NULL, + `task` int(11) NOT NULL, + `status_level` int(11) NOT NULL, + `user` varchar(50) CHARACTER SET utf8 COLLATE utf8_swedish_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `status_level` +-- + +CREATE TABLE IF NOT EXISTS `status_level` ( + `id` int(11) NOT NULL, + `plain_text` varchar(30) CHARACTER SET utf8 COLLATE utf8_swedish_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `task` +-- + +CREATE TABLE IF NOT EXISTS `task` ( + `id` int(11) NOT NULL, + `title` varchar(70) CHARACTER SET utf8 COLLATE utf8_swedish_ci NOT NULL, + `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_swedish_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `status` +-- +ALTER TABLE `status` + ADD PRIMARY KEY (`id`), + ADD KEY `status_constraint` (`task`,`status_level`), + ADD KEY `status_level_constraint` (`status_level`); + +-- +-- Indexes for table `status_level` +-- +ALTER TABLE `status_level` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `plain_text` (`plain_text`); + +-- +-- Indexes for table `task` +-- +ALTER TABLE `task` + ADD PRIMARY KEY (`id`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `status` +-- +ALTER TABLE `status` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `status_level` +-- +ALTER TABLE `status_level` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `task` +-- +ALTER TABLE `task` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +-- +-- Constraints for dumped tables +-- + +-- +-- Constraints for table `status` +-- +ALTER TABLE `status` + ADD CONSTRAINT `status_level_constraint` FOREIGN KEY (`status_level`) REFERENCES `status_level` (`id`) ON DELETE CASCADE, + ADD CONSTRAINT `status_task_constraint` FOREIGN KEY (`task`) REFERENCES `task` (`id`) ON DELETE CASCADE; + +/*!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 */; |