· 8 years ago · Jun 04, 2018, 10:04 AM
1-- ----------------------------
2-- Table structure for categories
3-- ----------------------------
4DROP TABLE IF EXISTS `categories`;
5CREATE TABLE `categories` (
6 `id` int(11) NOT NULL AUTO_INCREMENT,
7 `name` varchar(255) DEFAULT NULL,
8 `slug` varchar(255) DEFAULT NULL,
9 `description` text,
10 PRIMARY KEY (`id`)
11) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
12
13-- ----------------------------
14-- Records
15-- ----------------------------
16INSERT INTO `categories` VALUES ('1', 'Design', 'design-jobs', 'The design category');
17INSERT INTO `categories` VALUES ('2', 'Programming', 'programming-jobs', 'Programming jobs');
18INSERT INTO `categories` VALUES ('3', 'Other', 'other-jobs', 'Other jobs');
19
20
21-- Table structure for jobs
22-- ----------------------------
23DROP TABLE IF EXISTS `jobs`;
24CREATE TABLE `jobs` (
25 `id` int(11) NOT NULL DEFAULT '0',
26 `jobtype_id` int(11) NOT NULL DEFAULT '0',
27 `category_id` int(11) NOT NULL DEFAULT '0',
28 `creation_time` int(10) DEFAULT NULL,
29 `publish_time` int(10) DEFAULT NULL,
30 `title` varchar(100) DEFAULT NULL,
31 `location` varchar(100) DEFAULT NULL,
32 `content` text,
33 `how_to_apply` varchar(255) DEFAULT NULL,
34 PRIMARY KEY (`id`,`jobtype_id`,`category_id`),
35 KEY `category_id` (`category_id`),
36 KEY `jobtype_id` (`jobtype_id`),
37 CONSTRAINT `category_id` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE,
38 CONSTRAINT `jobtype_id` FOREIGN KEY (`jobtype_id`) REFERENCES `jobtypes` (`id`) ON DELETE CASCADE
39) ENGINE=InnoDB DEFAULT CHARSET=latin1;
40
41
42
43-- ----------------------------
44-- Table structure for jobtypes
45-- ----------------------------
46DROP TABLE IF EXISTS `jobtypes`;
47CREATE TABLE `jobtypes` (
48 `id` int(11) NOT NULL AUTO_INCREMENT,
49 `name` varchar(255) DEFAULT NULL,
50 `slug` varchar(255) DEFAULT NULL,
51 `description` text,
52 PRIMARY KEY (`id`)
53) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
54
55-- ----------------------------
56-- Records
57-- ----------------------------
58INSERT INTO `jobtypes` VALUES ('1', 'Fulltime', 'fulltime', 'Fulltime jobs');
59INSERT INTO `jobtypes` VALUES ('2', 'Freelance', 'freelance', 'Freelance jobs');
60INSERT INTO `jobtypes` VALUES ('3', 'Other', 'other', 'Other jobs');