/*
Navicat Premium Data Transfer
Source Server : localhost_3306
Source Server Type : MySQL
Source Server Version : 50718
Source Host : localhost:3306
Source Schema : epetshop
Target Server Type : MySQL
Target Server Version : 50718
File Encoding : 65001
Date: 12/10/2020 11:13:30
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for account
-- ----------------------------
DROP TABLE IF EXISTS `account`;
CREATE TABLE `account` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`deal_type` int(4) NULL DEFAULT NULL,
`pet_id` int(4) NULL DEFAULT NULL,
`seller_id` int(4) NULL DEFAULT NULL,
`buyer_id` int(4) NULL DEFAULT NULL,
`price` int(4) NULL DEFAULT NULL,
`deal_time` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `fk_account_pet`(`pet_id`) USING BTREE,
INDEX `fk_account_petOwner`(`seller_id`) USING BTREE,
CONSTRAINT `fk_account_pet` FOREIGN KEY (`pet_id`) REFERENCES `pet` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `fk_account_petOwner` FOREIGN KEY (`seller_id`) REFERENCES `petowner` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of account
-- ----------------------------
INSERT INTO `account` VALUES (2, 1, 4, 1, 1, 5, '2016-08-20 00:00:00');
INSERT INTO `account` VALUES (3, 1, 3, 1, 1, 5, '2016-08-20 00:00:00');
INSERT INTO `account` VALUES (4, 1, 3, 1, 1, 5, '2016-09-10 00:00:00');
INSERT INTO `account` VALUES (5, 2, 2, 2, 1, 3, '2016-09-10 00:00:00');
INSERT INTO `account` VALUES (6, 2, 3, 1, 1, 3, '2016-10-15 00:00:00');
INSERT INTO `account` VALUES (7, 2, 1, 1, 2, 5, '2020-10-09 00:00:00');
-- ----------------------------
-- Table structure for pet
-- ----------------------------
DROP TABLE IF EXISTS `pet`;
CREATE TABLE `pet` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`name` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`typeName` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`health` int(4) NULL DEFAULT NULL,
`love` int(4) NULL DEFAULT NULL,
`birthday` timestamp(0) NULL DEFAULT NULL,
`owner_id` int(4) NULL DEFAULT NULL,
`store_id` int(4) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `fk_pet_petOwner`(`owner_id`) USING BTREE,
INDEX `fk_pet_petStore`(`store_id`) USING BTREE,
CONSTRAINT `fk_pet_petOwner` FOREIGN KEY (`owner_id`) REFERENCES `petowner` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `fk_pet_petStore` FOREIGN KEY (`store_id`) REFERENCES `petstore` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of pet
-- ----------------------------
INSERT INTO `pet` VALUES (1, '花花', 'dog', 1, 50, '2015-08-20 00:00:00', NULL, 2);
INSERT INTO `pet` VALUES (2, '贝贝', 'penguin', 1, 60, '2015-08-20 00:00:00', NULL, 2);
INSERT INTO `pet` VALUES (3, '成成', 'dog', 1, 60, '2015-09-10 00:00:00', NULL, 1);
INSERT INTO `pet` VALUES (4, '露露', 'bird', 1, 70, '2016-01-10 00:00:00', NULL, 1);
INSERT INTO `pet` VALUES (5, '老虎', 'tiger', 1, 2, '2016-02-10 00:00:00', 2, NULL);
INSERT INTO `pet` VALUES (6, '老虎', 'tiger', 1, 2, '2016-03-15 00:00:00', NULL, 1);
INSERT INTO `pet` VALUES (7, '老虎', 'tiger', 1, 11, '2016-02-15 00:00:00', NULL, 1);
INSERT INTO `pet` VALUES (8, '狮子', 'lion', 1, 2, '2016-04-15 00:00:00', NULL, 2);
-- ----------------------------
-- Table structure for petowner
-- ----------------------------
DROP TABLE IF EXISTS `petowner`;
CREATE TABLE `petowner` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`name` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`password` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`money` int(4) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of petowner
-- ----------------------------
INSERT INTO `petowner` VALUES (1, '小明', '123456', 183);
INSERT INTO `petowner` VALUES (2, '小强', '123456', 498);
-- ----------------------------
-- Table structure for petstore
-- ----------------------------
DROP TABLE IF EXISTS `petstore`;
CREATE TABLE `petstore` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`password` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`balance` int(4) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of petstore
-- ----------------------------
INSERT INTO `petstore` VALUES (1, '北京信息中心', '123456', 624);
INSERT INTO `petstore` VALUES (2, '重庆观音桥', '123456', 795);
SET FOREIGN_KEY_CHECKS = 1;